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.google.dart.server.internal.remote.processor.ResultProcessor.java
RequestError generateRequestError(Exception exception) { String message = exception.getMessage(); String stackTrace = null;/* w w w .j a v a2s. c o m*/ if (exception.getStackTrace() != null) { stackTrace = ExceptionUtils.getStackTrace(exception); } return new RequestError(ExtendedRequestErrorCode.INVALID_SERVER_RESPONSE, message != null ? message : "", stackTrace); }
From source file:com.aurel.track.dbase.Migrate416To417.java
/** * Add the document and document section * Use JDBC because negative objectIDs should be added *///from w w w .j a v a 2 s . c om public static void addDeletedBasket() { TBasketBean basketBean = BasketBL.getBasketByID(TBasketBean.BASKET_TYPES.DELETED); if (basketBean == null) { LOGGER.info("Add 'Deleted basket' basket"); Connection cono = null; try { cono = InitDatabase.getConnection(); Statement ostmt = cono.createStatement(); cono.setAutoCommit(false); String deletedBasketStmt = addDeletedBasketStmt(TBasketBean.BASKET_TYPES.DELETED, "basket.label.-1", "-1001"); ostmt.executeUpdate(deletedBasketStmt); 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)); } } } }
From source file:com.aurel.track.util.StringArrayParameterUtils.java
public static int parseIntegerValue(Map<String, String[]> configParameters, String fieldName, int defaultValue) { int result = defaultValue; String[] strArr = null;/*from w w w. j ava 2 s.co m*/ if (configParameters != null) { try { strArr = (String[]) configParameters.get(fieldName); } catch (Exception e) { LOGGER.info("parseIntValue: converting the " + fieldName + " parameter to String[] failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } } if (strArr != null && strArr.length > 0) { String str = strArr[0]; if (str != null && !"".equals(str)) { try { result = Integer.parseInt(str); } catch (Exception e) { LOGGER.info("Converting the value " + str + " for field " + fieldName + " to int failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } } } return result; }
From source file:com.willwinder.universalgcodesender.utils.GUIHelpers.java
/** * Displays an error message to the user. * @param errorMessage message to display in the dialog. * @param modal toggle whether the message should block or fire and forget. *//* w ww .java 2s . c o m*/ public static void displayErrorDialog(final String errorMessage, boolean modal) { if (StringUtils.isEmpty(errorMessage)) { LOGGER.warning("Something tried to display an error message with an empty message: " + ExceptionUtils.getStackTrace(new Throwable())); return; } Runnable r = () -> { //JOptionPane.showMessageDialog(new JFrame(), errorMessage, // Localization.getString("error"), JOptionPane.ERROR_MESSAGE); NarrowOptionPane.showNarrowDialog(250, errorMessage.replaceAll("\\.\\.", "\\."), Localization.getString("error"), JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE); }; if (modal) { r.run(); } else { java.awt.EventQueue.invokeLater(r); } }
From source file:com.galenframework.ide.model.results.CommandExecutionResult.java
public static CommandExecutionResult error(Throwable ex) { CommandExecutionResult result = new CommandExecutionResult(); result.setStatus(ExecutionStatus.failed); result.setErrorMessages(//w w w . j a v a 2 s . c o m Collections.singletonList(ExceptionUtils.getMessage(ex) + "\n" + ExceptionUtils.getStackTrace(ex))); return result; }
From source file:com.aurel.track.persist.TVersionControlParameterPeer.java
public static List getByProject(Integer projectID, Connection con) { List torqueList = new ArrayList(); Criteria crit = new Criteria(); crit.add(PROJECT, projectID);/*from w w w .ja v a 2 s .co m*/ try { torqueList = doSelect(crit, con); } catch (TorqueException e) { LOGGER.debug(ExceptionUtils.getStackTrace(e)); } return torqueList; }
From source file:com.hack23.cia.service.data.impl.liquidbase.SpringLiquidBaseFailSafe.java
@Override public void afterPropertiesSet() throws LiquibaseException { try {//from w w w.j av a 2s . com super.afterPropertiesSet(); } catch (final LiquibaseException | RuntimeException e) { final String stackTrace = ExceptionUtils.getStackTrace(e); if (stackTrace.contains("Connection was already closed - calling hashCode is no longer allowed")) { LOGGER.warn("Problem after executing liquidbase, failed removing closed atomikos connection"); } else { LOGGER.warn("Problem executing liquidbase", e); } } }
From source file:joachimeichborn.geotag.logging.LongLogFormat.java
@Override public String format(final LogRecord aRecord) { final StringBuilder sb = new StringBuilder(); sb.append(new DateTime(aRecord.getMillis()).toString()); sb.append(" [").append(aRecord.getLevel().getName().charAt(0)).append("] "); sb.append(aRecord.getMessage());//w ww .j a v a2 s.co m sb.append(" <").append(aRecord.getLoggerName()).append(">"); sb.append(System.lineSeparator()); if (aRecord.getThrown() != null) { sb.append(ExceptionUtils.getStackTrace(aRecord.getThrown())); } return sb.toString(); }
From source file:com.aurel.track.attachment.BrowseFileBL.java
public static Integer storeImage(Integer workItemID, TPersonBean person, Locale locale, String imageData, boolean addToHistory) { String description = ""; String fileName = "image.jpg"; Integer attachKey = null;/*w ww . java 2s. c om*/ if (imageData != null) { byte[] bytearray = new Base64().decode(imageData); InputStream is = new ByteArrayInputStream(bytearray); try { TAttachmentBean attachmentBean = AttachBL.save(workItemID, description, fileName, is, person.getObjectID()); attachKey = attachmentBean.getObjectID(); if (addToHistory) { //add to history HistorySaverBL.addAttachment(workItemID, person.getObjectID(), locale, fileName, description, Long.valueOf(bytearray.length), false); } } catch (AttachBLException e) { LOGGER.debug(ExceptionUtils.getStackTrace(e)); } } return attachKey; }
From source file:com.baasbox.service.storage.CollectionService.java
public static ODocument create(String collectionName) throws Throwable, InvalidCollectionException, InvalidModelException { try {/* ww w. j a v a 2 s.c o m*/ CollectionDao dao = CollectionDao.getInstance(); ODocument doc = dao.create(collectionName); return doc; } catch (OSerializationException e) { DbHelper.rollbackTransaction(); throw new InvalidJsonException(e); } catch (InvalidJsonException e) { DbHelper.rollbackTransaction(); throw e; } catch (UserAlreadyExistsException e) { DbHelper.rollbackTransaction(); throw e; } catch (Exception e) { DbHelper.rollbackTransaction(); throw new RuntimeException(ExceptionUtils.getStackTrace(e)); } }