Skip to content

Commit

Permalink
Caught JLine sneaky throw properly.
Browse files Browse the repository at this point in the history
  • Loading branch information
MattGill98 committed Aug 12, 2019
1 parent e874701 commit 5b82eae
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,12 @@ private String retry(int times) throws CommandException {
try {
char[] mpvArr = super.readPassword(prompt);
mpv = mpvArr != null ? new String(mpvArr) : null;
} catch (Throwable t) {
throw new CommandException(STRINGS.get("no.console"), t);
} catch (Exception ex) {
// JLine sneaky throws IOException, so check for it here
if (ex instanceof IOException) {
throw new CommandException(STRINGS.get("no.console"), ex);
}
throw ex;
}
if (mpv == null)
throw new CommandException(STRINGS.get("no.console"));
Expand Down

1 comment on commit 5b82eae

@dmatej
Copy link
Contributor

@dmatej dmatej commented on 5b82eae Aug 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about this?:

        } catch (IOException ex) {
                throw new CommandException(STRINGS.get("no.console"), ex);
        }

Please sign in to comment.