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.persist.TScreenFieldPeer.java
/** * Loads the screenField by primary key/* ww w. jav a2 s . co m*/ * @param objectID * @return */ @Override public TScreenFieldBean loadByPrimaryKey(Integer objectID) { TScreenField tobject = null; try { tobject = retrieveByPK(objectID); } catch (Exception e) { LOGGER.warn("Loading of a screenField by primary key " + objectID + " failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } if (tobject != null) { return tobject.getBean(); } return null; }
From source file:com.aurel.track.fieldType.fieldChange.converter.DateSetterConverter.java
/** * Convert the string to object value after load * @param value//from w ww. j a va 2 s. c om * @param setter * @return */ @Override public Object getActualValueFromStoredString(String value, Integer setter) { if (value == null || value.trim().length() == 0 || value.trim().equals("null") || setter == null) { return null; } switch (setter.intValue()) { case FieldChangeSetters.MOVE_BY_DAYS: case FieldChangeSetters.SET_TO_DATE_FIELD_VALUE: Integer intValue = null; try { intValue = Integer.valueOf(value); } catch (Exception e) { LOGGER.info("Converting the " + value + " to Integer from string failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } return intValue; case FieldChangeSetters.SET_TO: return DateTimeUtils.getInstance().parseISODate(value); } return null; }
From source file:at.ac.tuwien.dsg.comot.m.common.event.state.ExceptionMessage.java
public ExceptionMessage(String serviceId, String origin, Long time, String eventCauseId, Exception exception) { super();//from w ww.j a va 2 s . c om Throwable root = ExceptionUtils.getRootCause(exception); String type; String message; String details; if (root == null) { type = exception.getClass().getName(); message = exception.getMessage(); details = ExceptionUtils.getStackTrace(exception); } else { type = root.getClass().getName(); message = root.getMessage(); details = ExceptionUtils.getStackTrace(root); } this.origin = origin; this.type = type; this.message = message; this.details = details; this.serviceId = serviceId; this.time = time; this.eventCauseId = eventCauseId; }
From source file:com.bloomreach.zk.replicate.ZookeeperDataTraverser.java
/** * Triggers the recursive fetch of all the zk data for a given path * * @return znode Zookeeper Data Node that stores all zookeeper path data * @throws Exception/*from w ww. j av a 2 s . c om*/ */ public ZkDataNode traverse() throws Exception { try { populate(znode); } catch (KeeperException e) { throw new ZkDataTraversalException(ExceptionUtils.getStackTrace(e)); } catch (InterruptedException e) { throw new ZkDataTraversalException(ExceptionUtils.getStackTrace(e)); } return znode; }
From source file:com.aurel.track.persist.TOptionSettingsPeer.java
/** * Loads an option settings by primary key * @param objectID/*from w w w .j a v a 2 s. c o m*/ * @return */ @Override public TOptionSettingsBean loadByPrimaryKey(Integer objectID) { TOptionSettings tOptionSettings = null; try { tOptionSettings = retrieveByPK(objectID); } catch (Exception e) { LOGGER.warn( "Loading of an option settings by primary key " + objectID + " failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } if (tOptionSettings != null) { return tOptionSettings.getBean(); } return null; }
From source file:com.aurel.track.persist.TGeneralSettingsPeer.java
/** * Loads a general settings by primary key * @param roleID/* w w w . j a va 2s .c om*/ * @return */ @Override public TGeneralSettingsBean loadByPrimaryKey(Integer objectID) { TGeneralSettings tGeneralSettings = null; try { tGeneralSettings = retrieveByPK(objectID); } catch (Exception e) { LOGGER.warn( "Loading of a general settings by primary key " + objectID + " failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } if (tGeneralSettings != null) { return tGeneralSettings.getBean(); } return null; }
From source file:io.galeb.router.handlers.InfoHandler.java
private String getUptimeSO() { ProcessBuilder processBuilder = new ProcessBuilder("uptime"); processBuilder.redirectErrorStream(true); try {// w ww . j a v a 2 s . co m Process process = processBuilder.start(); return IOUtils.toString(process.getInputStream(), "UTF-8").replace("\n", ""); } catch (Exception e) { logger.error(ExceptionUtils.getStackTrace(e)); return ""; } }
From source file:com.aurel.track.exchange.latex.exporter.LaTeXExportBL.java
/** * Serializes the docx content into the response's output stream * @param response//from w w w. j a v a 2 s . com * @param wordMLPackage * @return */ public static String prepareReportResponse(HttpServletResponse response, TWorkItemBean workItem, ReportBeans reportBeans, TPersonBean user, Locale locale, String templateDir, String templateFile) { ReportBeansToLaTeXConverter rl = new ReportBeansToLaTeXConverter(); File pdf = rl.generatePdf(workItem, reportBeans.getItems(), true, locale, user, "", "", false, new File(templateFile), new File(templateDir)); String fileName = workItem.getSynopsis() + ".pdf"; String contentType = "application/pdf"; if (pdf.length() < 10) { pdf = new File(pdf.getParent() + "/errors.txt"); fileName = workItem.getSynopsis() + ".txt"; contentType = "text"; } OutputStream outputStream = null; try { response.reset(); response.setHeader("Content-Type", contentType); response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\""); DownloadUtil.prepareCacheControlHeader(ServletActionContext.getRequest(), response); outputStream = response.getOutputStream(); InputStream is = new FileInputStream(pdf); IOUtils.copy(is, outputStream); is.close(); } catch (FileNotFoundException e) { LOGGER.error(ExceptionUtils.getStackTrace(e)); } catch (IOException e) { LOGGER.error("Getting the output stream failed with " + e.getMessage()); LOGGER.error(ExceptionUtils.getStackTrace(e)); } catch (Exception e) { LOGGER.error(ExceptionUtils.getStackTrace(e)); } // Docx4J.save(wordMLPackage, outputStream, Docx4J.FLAG_NONE); // //wordMLPackage.save(outputStream); // /*SaveToZipFile saver = new SaveToZipFile(wordMLPackage); // saver.save(outputStream);*/ // } catch (Exception e) { // LOGGER.error("Exporting the docx failed with throwable " + e.getMessage()); // LOGGER.debug(ExceptionUtils.getStackTrace(e)); // } return null; }
From source file:com.aurel.track.fieldType.runtime.matchers.converter.SelectMatcherConverter.java
/** * Convert the object value to xml string for save * @param value/* w ww .jav a2 s . c o m*/ * @param matcherRelation * @return */ @Override public String toXMLString(Object value, Integer matcherRelation) { if (value == null || matcherRelation == null) { return null; } switch (matcherRelation.intValue()) { case MatchRelations.EQUAL: case MatchRelations.NOT_EQUAL: Integer[] intArr = null; try { intArr = (Integer[]) value; } catch (Exception e) { LOGGER.warn( "Converting the " + value + " to Integer[] for XML string failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } if (intArr != null && intArr.length > 0) { Integer intValue = intArr[0]; if (intValue != null) { return intValue.toString(); } } } return ""; }
From source file:com.aurel.track.persist.TTextBoxSettingsPeer.java
/** * Loads a textbox settings by primary key * @param objectID//from w w w . j ava2 s. c o m * @return */ @Override public TTextBoxSettingsBean loadByPrimaryKey(Integer objectID) { TTextBoxSettings tTextBoxSettings = null; try { tTextBoxSettings = retrieveByPK(objectID); } catch (Exception e) { LOGGER.warn( "Loading of a text box settings by primary key " + objectID + " failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } if (tTextBoxSettings != null) { return tTextBoxSettings.getBean(); } return null; }