/** * Returns the nested exception, if any. * * @return the nested exception, or <code>null</code> if no * exception is associated with this one * @deprecated Use {@link #getCause} instead. */ @Deprecated public Throwable getException() { return getCause(); }
private void testFileNameInStackTrace(final String target, final String fileNamePattern) { try { project.executeTarget(target); fail(); } catch (final BuildException e) { assertEquals(BuildException.class, e.getClass()); final Throwable cause = e.getCause(); assertTrue(cause instanceof GroovyRuntimeException); final StringWriter sw = new StringWriter(); cause.printStackTrace(new PrintWriter(sw)); final String stackTrace = sw.toString(); final Pattern pattern = Pattern.compile(fileNamePattern); assertTrue("Does >" + stackTrace + "< contain >" + fileNamePattern + "<?", pattern.matcher(stackTrace).find()); } } }
throw(e); Throwable t = e.getCause(); if (t == null) { t = e;
/** @return Whether {@code be} wraps a {@link ContinueException} */ public static boolean isWrappedBy(BuildException be) { for (Throwable t = be.getCause(); t != null; t = t.getCause()) { if (t instanceof ContinueException) return true; } return false; } }
/** @return Whether {@code be} wraps a {@link BreakException} */ public static boolean isWrappedBy(BuildException be) { for (Throwable t = be.getCause(); t != null; t = t.getCause()) { if (t instanceof BreakException) return true; } return false; } }
+ connectTimeout + "ms)."; failureReason = NodeStepFailureReason.ConnectionTimeout; } else if (null != e.getCause() && e.getCause() instanceof JSchException) { JSchException jSchException = (JSchException) e.getCause(); return extractJschFailure(node, commandTimeout, connectTimeout, jSchException, framework); } else if (e.getMessage().contains("Remote command failed with exit status")) { errormsg = e.getMessage(); failureReason = NodeStepFailureReason.NonZeroResultCode; } else if (null != e.getCause() && e.getCause() instanceof InterruptedException) { failureReason = StepFailureReason.Interrupted; errormsg = "Connection was interrupted";
+ " See log for details.", ex.getCause(), ex.getLocation());
throw new MojoExecutionException("An I/O error occurred: " + e.getMessage(), e); } catch (BuildException e) { throw new MojoExecutionException(e.getMessage(), e.getCause()); } catch (Throwable t) { throw new RuntimeException(t);
} catch (BuildException e) { throw new BuildException(e.getMessage() + " - for database: " + databaseAlias, e.getCause());
+ " See log for details.", ex.getCause(), ex.getLocation());
} catch (BuildException e) { throw new BuildException(e.getMessage() + " - for database: " + databaseAlias, e.getCause());
+ " See Cargo log for details.", e.getCause(), e.getLocation());