private void addSuppressedThrowable(Throwable t) { try { this.getClass().getMethod("addSuppressed", Throwable.class).invoke(this, t); } catch (Throwable t2) { //java < 1.7 suppressed.add(t); if (getCause() == null) { initCause(t); } hasSuppressed = true; } }
private void addSuppressedThrowable(Throwable t) { try { this.getClass().getMethod("addSuppressed", Throwable.class).invoke(this, t); } catch (Throwable t2) { //java < 1.7 suppressed.add(t); if (getCause() == null) { initCause(t); } hasSuppressed = true; } }
public void printStackTrace(PrintStream ps, String pfx, String cap) { ps.println(pfx + cap + this); StackTraceElement[] trace = super.getStackTrace(); for (StackTraceElement traceElement : trace) { ps.println(pfx + "\tat " + traceElement); } // Print suppressed exceptions, if any for (Throwable se : suppressed) { printThrowable(se, ps, pfx + "\t", "Suppressed: "); } // Print cause, if any Throwable ourCause = getCause(); if (ourCause != null && (!hasSuppressed || ourCause != suppressed.get(0))) { printThrowable(ourCause, ps, pfx + "\t", "Caused by: "); } } private void printThrowable(Throwable t, PrintStream ps, String pfx, String cap) {
public void printStackTrace(PrintStream ps, String pfx, String cap) { ps.println(pfx + cap + this); StackTraceElement[] trace = super.getStackTrace(); for (StackTraceElement traceElement : trace) { ps.println(pfx + "\tat " + traceElement); } // Print suppressed exceptions, if any for (Throwable se : suppressed) { printThrowable(se, ps, pfx + "\t", "Suppressed: "); } // Print cause, if any Throwable ourCause = getCause(); if (ourCause != null && (!hasSuppressed || ourCause != suppressed.get(0))) { printThrowable(ourCause, ps, pfx + "\t", "Caused by: "); } } private void printThrowable(Throwable t, PrintStream ps, String pfx, String cap) {
public void execute(boolean exitOnFinish) throws ToolException { try { if (getArgument() != null) { super.execute(exitOnFinish); } execute(); } catch (ToolException ex) { if (ex.getCause() instanceof BadUsageException) { printUsageException(toolName, (BadUsageException)ex.getCause()); } throw ex; } catch (Exception ex) { throw new ToolException(ex); } finally { tearDown(); } }
public void execute(boolean exitOnFinish) throws ToolException { try { if (getArgument() != null) { super.execute(exitOnFinish); } execute(); } catch (ToolException ex) { if (ex.getCause() instanceof BadUsageException) { printUsageException(TOOL_NAME, (BadUsageException)ex.getCause()); } throw ex; } catch (Exception ex) { throw new ToolException(ex); } finally { tearDown(); } }
public void execute(boolean exitOnFinish) throws ToolException { try { if (getArgument() != null) { super.execute(exitOnFinish); } execute(); } catch (ToolException ex) { if (ex.getCause() instanceof BadUsageException) { printUsageException(TOOL_NAME, (BadUsageException)ex.getCause()); } throw ex; } catch (Exception ex) { throw new ToolException(ex); } finally { tearDown(); } }
public void execute(boolean exitOnFinish) throws ToolException { try { if (getArgument() != null) { super.execute(exitOnFinish); } execute(); } catch (ToolException ex) { if (ex.getCause() instanceof BadUsageException) { printUsageException(toolName, (BadUsageException)ex.getCause()); } throw ex; } catch (Exception ex) { throw new ToolException(ex); } finally { tearDown(); } }