List of usage examples for org.apache.commons.lang3.exception ExceptionUtils getStackTrace
public static String getStackTrace(final Throwable throwable)
Gets the stack trace from a Throwable as a String.
The result of this method vary by JDK version as this method uses Throwable#printStackTrace(java.io.PrintWriter) .
From source file:com.aurel.track.exchange.docx.exporter.NumberingUtil.java
static void setNumbering(WordprocessingMLPackage newPkg) { java.io.InputStream is = null; try {//from w ww . j a va 2 s . com is = ResourceUtils.getResource("com/aurel/track/exchange/docx/exporter/numbering.xml"); } catch (IOException e) { LOGGER.error("Getting the KnownStyles.xml failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } JAXBContext jc = Context.jc; Unmarshaller unmarshaller = null; try { unmarshaller = jc.createUnmarshaller(); } catch (JAXBException e) { LOGGER.error("Creating a JAXB unmarshaller failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } try { unmarshaller.setEventHandler(new JaxbValidationEventHandler()); } catch (JAXBException e) { LOGGER.error("Setting the event handler for JAXB unmarshaller failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } Numbering numbering = null; try { numbering = (Numbering) unmarshaller.unmarshal(is); } catch (JAXBException e) { LOGGER.error("Unmarshalling the numbering.xml failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } NumberingDefinitionsPart numberingDefinitionsPart = null; try { numberingDefinitionsPart = new NumberingDefinitionsPart(); } catch (InvalidFormatException e) { LOGGER.error("Creating the styles definition part failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } numberingDefinitionsPart.setPackage(newPkg); numberingDefinitionsPart.setJaxbElement(numbering); try { newPkg.getMainDocumentPart().addTargetPart(numberingDefinitionsPart); } catch (InvalidFormatException e) { LOGGER.error("Adding the target part to MainDocumentPart failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } }
From source file:com.r573.enfili.ws.jersey.GeneralExceptionMapper.java
@Override public Response toResponse(Exception e) { log.error(ExceptionUtils.getStackTrace(e)); GenericEntity<String> entity = new GenericEntity<String>(JsonHelper.toJson(new WsResponse<WsError>( WsResponse.RESP_CODE_ERROR, new WsError(WsError.GENERAL_ERROR, "General Error")))) { };//w w w . jav a2 s.c o m return Response.status(Status.OK).entity(entity).type(MediaType.APPLICATION_JSON).build(); }
From source file:it.unibo.alchemist.utils.L.java
/** * Logs a String describing the error followed by the stacktrace. * /*from w w w .ja v a 2 s. co m*/ * @param s * the String to log * @param e * the Throwable to get and print the stacktrace */ @Deprecated public static void error(final String s, final Throwable e) { error(s + "\n" + ExceptionUtils.getStackTrace(e)); }
From source file:at.bitfire.davdroid.log.PlainTextFormatter.java
@Override @SuppressWarnings("ThrowableResultOfMethodCallIgnored") public String format(LogRecord r) { StringBuilder builder = new StringBuilder(); if (!logcat)// www . j a v a 2 s. c o m builder.append(DateFormatUtils.format(r.getMillis(), "yyyy-MM-dd HH:mm:ss")).append(" ") .append(r.getThreadID()).append(" "); builder.append(String.format("[%s] %s", shortClassName(r.getSourceClassName()), r.getMessage())); if (r.getThrown() != null) builder.append("\nEXCEPTION ").append(ExceptionUtils.getStackTrace(r.getThrown())); if (r.getParameters() != null) { int idx = 1; for (Object param : r.getParameters()) builder.append("\n\tPARAMETER #").append(idx++).append(" = ").append(param); } if (!logcat) builder.append("\n"); return builder.toString(); }
From source file:com.galenframework.reports.ExceptionReportNode.java
public String getStacktrace() { return ExceptionUtils.getStackTrace(exception); }
From source file:com.callidusrobotics.droptables.model.ResultDao.java
public ResultDao(Datastore datastore) { super(datastore); try {//from w w w . j ava2s.c om datastore.ensureIndexes(); } catch (MongoCommandException e) { LOGGER.error("Unable to ensure indexes: " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } }
From source file:alluxio.ProcessUtils.java
/** * Logs a fatal error and then exits the system. * * @param logger the logger to log to//from w w w.ja v a2 s . co m * @param t the throwable causing the fatal error * @param format the error message format string * @param args args for the format string */ public static void fatalError(Logger logger, Throwable t, String format, Object... args) { String message = String.format("Fatal error: " + format, args); if (t != null) { message += "\n" + ExceptionUtils.getStackTrace(t); } if (Configuration.getBoolean(PropertyKey.TEST_MODE)) { throw new RuntimeException(message); } logger.error(message); System.exit(-1); }
From source file:com.aurel.track.dbase.Migrate415To416.java
/** * Add the document and document section * Use JDBC because negative objectIDs should be added *//*from ww w .ja va 2 s .c om*/ public static void addNewItemTypes() { LOGGER.info("Add new item types"); List<String> itemTypeStms = new ArrayList<String>(); TListTypeBean docIssueTypeBean = IssueTypeBL.loadByPrimaryKey(-6); if (docIssueTypeBean == null) { LOGGER.info("Add 'Document folder' item type"); itemTypeStms.add(addItemtype(-6, "Document folder", 6, -6, "documentFolder.png", "2009")); } Connection cono = null; try { cono = InitDatabase.getConnection(); Statement ostmt = cono.createStatement(); cono.setAutoCommit(false); for (String filterClobStmt : itemTypeStms) { ostmt.executeUpdate(filterClobStmt); } cono.commit(); cono.setAutoCommit(true); } catch (Exception e) { LOGGER.debug(ExceptionUtils.getStackTrace(e)); } finally { try { if (cono != null) { cono.close(); } } catch (Exception e) { LOGGER.info("Closing the connection failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } } //children types List<TChildIssueTypeBean> childIssueTypeBeans = ChildIssueTypeAssignmentsBL .loadByChildAssignmentsByParent(-6); if (childIssueTypeBeans == null || childIssueTypeBeans.isEmpty()) { //document may have only document section children ChildIssueTypeAssignmentsBL.save(-6, -4); } }
From source file:com.braffdev.server.core.utilities.ServerUtilities.java
/** * Returns a String representation of the given Throwable that can be used for displaying it in web browsers.<br /> * In detail line breaks (\n) are being replaced by <br /> <br/> * and line feeds (\t) are being replaced by &nbsp;&nbsp;&nbsp; * * @param e//ww w .j ava 2 s .c om * @return */ public static String getStackTraceForWeb(Throwable e) { String stackTrace = ExceptionUtils.getStackTrace(e); stackTrace = stackTrace.replace("\n", "<br />"); return stackTrace.replace("\t", " "); }
From source file:com.twosigma.beaker.jvm.updater.Updater.java
private void deliverError(Exception e) { SimpleEvaluationObject error = SimpleEvaluationObject.createError(ExceptionUtils.getStackTrace(e)); this.session.deliver(this.localSession, this.channelId, error, null); }