Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for WFCORE-3225. CLI exception, keep calling stack #2827

Merged
merged 1 commit into from
Sep 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 11 additions & 7 deletions cli/src/main/java/org/jboss/as/cli/impl/CommandContextImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -829,12 +829,7 @@ private <T> T execute(Callable<T> c, String msg) throws CommandLineException {
Thread.currentThread().interrupt();
throw new CommandLineException("Interrupt exception for " + msg);
} catch (ExecutionException ex) {
Throwable cause = ex.getCause() == null ? ex : ex.getCause();
if (cause instanceof CommandLineException) {
throw (CommandLineException) cause;
}
throw new CommandLineException("Execution exception for " + msg
+ ": " + cause.getMessage(), cause);
throw new CommandLineException(ex);
} catch (CommandLineException ex) {
throw ex;
} catch (Exception ex) {
Expand All @@ -846,7 +841,16 @@ public void handleSafe(String line) {
exitCode = 0;
try {
handle(line);
} catch(Throwable t) {
} catch (Throwable t) {
// Remove exceptions that are wrappers to not pollute error message.
if (t instanceof CommandLineException
&& t.getCause() instanceof ExecutionException) {
// Get the ExecutionException cause.
Throwable cause = t.getCause().getCause();
if (cause != null) {
t = cause;
}
}
error(Util.getMessagesFromThrowable(t));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ protected void assertConflicts(CommandLineException e, String... conflicts) {
buf.append(", ");
}
}
assertEquals(e.getMessage().split(System.getProperty("line.separator"))[0], buf.toString());
String msg = e.getMessage().substring(e.getMessage().indexOf(PatchLogger.ROOT_LOGGER.detectedConflicts()));
assertEquals(msg.split(System.getProperty("line.separator"))[0], buf.toString());
}
}