/** * Log the specified Throwable. * @param t the Throwable to log. * @since 1.6.2 */ private void log(Throwable t) { log(StringUtils.getStackTrace(t), Project.MSG_ERR); }
static void throwableMessage(StringBuffer m, Throwable error, boolean verbose) { while (error instanceof BuildException) { // #43398 Throwable cause = error.getCause(); if (cause == null) { break; } String msg1 = error.toString(); String msg2 = cause.toString(); if (msg1.endsWith(msg2)) { m.append(msg1, 0, msg1.length() - msg2.length()); error = cause; } else { break; } } if (verbose || !(error instanceof BuildException)) { m.append(StringUtils.getStackTrace(error)); } else { m.append(String.format("%s%n", error)); } }
/** * read the output stream to retrieve the new task number. * @param is InputStream * @throws IOException on error */ @Override public void setProcessOutputStream(InputStream is) throws IOException { try (BufferedReader reader = new BufferedReader(new InputStreamReader(is))) { String buffer = reader.readLine(); if (buffer != null) { log("buffer:" + buffer, Project.MSG_DEBUG); String taskstring = buffer.substring(buffer.indexOf(' ')).trim(); taskstring = taskstring.substring(0, taskstring.lastIndexOf(' ')).trim(); setTask(taskstring); log("task is " + getTask(), Project.MSG_DEBUG); } } catch (NullPointerException npe) { log("error procession stream, null pointer exception", Project.MSG_ERR); log(StringUtils.getStackTrace(npe), Project.MSG_ERR); throw new BuildException(npe); } catch (Exception e) { log("error procession stream " + e.getMessage(), Project.MSG_ERR); throw new BuildException(e.getMessage()); } }
log(StringUtils.getStackTrace(ioe), Project.MSG_ERR); } finally { FileUtils.close(bw);
Text errText = doc.createCDATASection(StringUtils.getStackTrace(t)); Element stacktrace = doc.createElement(STACKTRACE_TAG); stacktrace.appendChild(errText);
} catch (IOException e) { log("An IOException has occurred while trying to execute ejbc."); log(StringUtils.getStackTrace(e)); } catch (InterruptedException e) {
if (Project.MSG_DEBUG <= msgOutputLevel && ex != null) { message.append(String.format("%n%s: ", ex.getClass().getSimpleName())) .append(StringUtils.getStackTrace(ex));
final String msg = "Unable to obtain resource from " + file + ": "; log(msg + e, Project.MSG_WARN); log(StringUtils.getStackTrace(e), Project.MSG_WARN);
Text errText = doc.createCDATASection(StringUtils.getStackTrace(ex)); Element stacktrace = doc.createElement(STACKTRACE_TAG); stacktrace.appendChild(errText);
/** * Get the Liaison implementation to use in processing. * * @return an instance of the XSLTLiaison interface. */ protected XSLTLiaison getLiaison() { // if processor wasn't specified, use TraX. if (liaison == null) { if (processor != null) { try { resolveProcessor(processor); } catch (final Exception e) { handleError(e); } } else { try { resolveProcessor(PROCESSOR_TRAX); } catch (final Throwable e1) { log(StringUtils.getStackTrace(e1), Project.MSG_ERR); handleError(e1); } } } return liaison; }
+ "' failed with message '" + thrownException.getMessage() + "'.", Project.MSG_ERR); log(StringUtils.getStackTrace(thrownException), Project.MSG_ERR); if (buildException == null) { buildException =
log(StringUtils.getStackTrace(ex), Project.MSG_ERR);
/** * Returns a filtered stack trace. * This is ripped out of junit.runner.BaseTestRunner. * @param t the exception to filter. * @return the filtered stack trace. */ public static String getFilteredTrace(final Throwable t) { final String trace = StringUtils.getStackTrace(t); return JUnitTestRunner.filterStack(trace); }
public void buildFinished(final BuildEvent event) { final Throwable error = event.getException(); final StringBuilder message = new StringBuilder(); if (error != null) { message.append("Command failed."); message.append(lSep); if (Project.MSG_VERBOSE <= msgOutputLevel || !(error instanceof BuildException)) { message.append(org.apache.tools.ant.util.StringUtils.getStackTrace(error)); } else { message.append(error.toString()).append(lSep); } listener.log(Project.MSG_ERR, message.toString()); } }
private static String throwableMessage(Throwable error, boolean verbose) { StringBuilder m = new StringBuilder(); while (error instanceof BuildException) { Throwable cause = error.getCause(); if (cause == null) { break; } String msg1 = error.toString(); String msg2 = cause.toString(); if (msg1.endsWith(msg2)) { m.append(msg1.substring(0, msg1.length() - msg2.length())); error = cause; } else { break; } } if (verbose || !(error instanceof BuildException)) { m.append(StringUtils.getStackTrace(error)); } else { m.append(error); } return m.toString(); }
private void writeJavaClass() { try { File sourceFile = new File(getLocationName() + ".java"); verbose("Write collector class to '" + sourceFile.getAbsolutePath() + "'"); if (sourceFile.exists() && !sourceFile.delete()) { throw new IOException("could not delete " + sourceFile); } writer = new BufferedWriter(new FileWriter(sourceFile)); createClassHeader(); createSuiteMethod(); createClassFooter(); } catch (IOException e) { log(StringUtils.getStackTrace(e)); } finally { FileUtils.close(writer); } }
message.append(StringUtils.getStackTrace(ex));
log(StringUtils.getStackTrace(e), Project.MSG_DEBUG); } catch (IOException e) { log("Error while accessing file " + file + ": "
log(StringUtils.getStackTrace(e), Project.MSG_INFO);