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.TWorkItemLinkPeer.java
/** * Loads a workItemLinkBean by primary key * @param objectID//from w w w . j a va 2 s . c o m * @return */ @Override public TWorkItemLinkBean loadByPrimaryKey(Integer objectID) { TWorkItemLink link = null; try { link = retrieveByPK(objectID); } catch (Exception e) { LOGGER.warn("Loading of a link by primary key " + objectID + " failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } if (link != null) { return link.getBean(); } return null; }
From source file:com.barclays.dfe.fw.DFEErrorPacket.java
@Override // For now do the simple ones. public String toString() { StringBuilder result = new StringBuilder(); String newLine = System.getProperty("line.separator"); result.append(newLine);/*from ww w . ja va2 s . c o m*/ //result.append( this.getClass().getName() ); if (dtx != null) { result.append(" DFE Context Settings {"); result.append(this.dtx.toString()); result.append("}"); result.append(newLine); } result.append(" DFE Error Packet Details {"); result.append(newLine); result.append(newLine); result.append(ExceptionUtils.getStackTrace(DFEError)); result.append("}"); return result.toString(); }
From source file:com.aurel.track.dbase.DatabaseHandler.java
/** * Start the database server. If it was running, stop it first. *//* w ww.ja v a 2s. c o m*/ public static void startDbServer() { System.setProperty("derby.drda.startNetworkServer", "true"); stopDbServer(); try { dbServer = new NetworkServerControl(InetAddress.getByName("localhost"), 15270, user, password); java.io.PrintWriter consoleWriter = new java.io.PrintWriter(System.out, true); dbServer.start(consoleWriter); checkForDatabase(); } catch (Exception e) { LOGGER.error(ExceptionUtils.getStackTrace(e)); } }
From source file:com.aurel.track.dbase.Migrate502To503.java
private static void addDuration(Integer durationField, String name, String fieldType, String label, String tooltip) {// w w w .ja v a2 s.com TFieldBean durationFieldBean = FieldBL.loadByPrimaryKey(durationField); if (durationFieldBean == null) { LOGGER.info("Adding duration field " + durationField); Connection cono = null; try { cono = InitDatabase.getConnection(); Statement ostmt = cono.createStatement(); cono.setAutoCommit(false); ostmt.executeUpdate(addField(durationField, name, fieldType)); ostmt.executeUpdate(addFieldConfig(durationField, durationField, label, tooltip)); cono.commit(); cono.setAutoCommit(true); } catch (Exception e) { LOGGER.debug(ExceptionUtils.getStackTrace(e)); } finally { try { if (cono != null) { cono.close(); } } catch (Exception e) { LOGGER.debug(ExceptionUtils.getStackTrace(e)); } } } }
From source file:com.mirth.connect.server.servlets.WebStartServlet.java
@Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // MIRTH-1745 response.setCharacterEncoding("UTF-8"); try {/*from w w w .j av a2s .co m*/ response.setContentType("application/x-java-jnlp-file"); response.setHeader("Pragma", "no-cache"); PrintWriter out = response.getWriter(); Document jnlpDocument = null; if (request.getServletPath().equals("/webstart.jnlp") || request.getServletPath().equals("/webstart")) { jnlpDocument = getAdministratorJnlp(request); } else if (request.getServletPath().equals("/webstart/extensions")) { String extensionPath = StringUtils.removeEnd(StringUtils.removeStart(request.getPathInfo(), "/"), ".jnlp"); jnlpDocument = getExtensionJnlp(extensionPath); } DocumentSerializer docSerializer = new DocumentSerializer(true); docSerializer.toXML(jnlpDocument, out); } catch (RuntimeIOException rio) { logger.debug(rio); } catch (Throwable t) { logger.error(ExceptionUtils.getStackTrace(t)); throw new ServletException(t); } }
From source file:com.aurel.track.persist.TDashboardParameterPeer.java
public static void deleteByDashboardField(Integer fieldID, Connection con) { Criteria crit = new Criteria(); crit.add(DASHBOARDFIELD, fieldID);// ww w . j a va2 s .c om try { doDelete(crit, con); } catch (TorqueException e) { LOGGER.debug(ExceptionUtils.getStackTrace(e)); } }
From source file:ke.co.tawi.babblesms.server.persistence.utils.CountUtils.java
/** * Gets the count of all IncomingLog requests belonging to this account. * * @param accountuuid/*ww w .j a va 2 s . c o m*/ * * @return total count of incominglog requests */ public int getIncomingCount(String accountuuid) { int count = 0; try (Connection conn = dbCredentials.getConnection(); PreparedStatement pstmt = conn .prepareStatement("SELECT count(*) FROM incominglog WHERE recipientuuid = ?;");) { pstmt.setString(1, accountuuid); try (ResultSet rset = pstmt.executeQuery();) { rset.next(); count = count + rset.getInt(1); } } catch (SQLException e) { logger.error( "SQLException while getting all incoming SMS count of account with uuid '" + accountuuid + "'"); logger.error(ExceptionUtils.getStackTrace(e)); } return count; }
From source file:com.aurel.track.item.action.CopyItemActionPlugin.java
@Override public String encodeJsonDataStep1(Locale locale, TPersonBean user, Integer workItemID, Integer parentID, Integer projectID, Integer issueTypeID, String synopsis, String description) throws PluginItemActionException { StringBuilder sb = new StringBuilder(); sb.append("{"); TWorkItemBean workItem = null;//w w w . j a v a2s . c om try { workItem = ItemBL.loadWorkItem(workItemID); JSONUtility.appendBooleanValue(sb, "hasChildren", ItemBL.hasChildren(workItemID)); JSONUtility.appendBooleanValue(sb, "deepCopy", false); JSONUtility.appendBooleanValue(sb, "copyAttachments", false); JSONUtility.appendBooleanValue(sb, "copyChildren", false); JSONUtility.appendIntegerValue(sb, "projectID", workItem.getProjectID()); JSONUtility.appendIntegerValue(sb, "issueTypeID", workItem.getListTypeID()); JSONUtility.appendIntegerValue(sb, "workItemID", workItem.getObjectID()); JSONUtility.appendStringValue(sb, "issueNoLabel", FieldRuntimeBL.getLocalizedDefaultFieldLabel(SystemFields.INTEGER_ISSUENO, locale)); JSONUtility.appendStringValue(sb, "statusDisplay", StatusBL.getStatusDisplay(workItem.getStateID(), locale)); JSONUtility.appendStringValue(sb, "synopsis", workItem.getSynopsis(), true); } catch (ItemLoaderException e) { LOGGER.error(ExceptionUtils.getStackTrace(e)); sb.append("success:false,errorMessage:").append(e.getMessage()); } sb.append("}"); return sb.toString(); }
From source file:ke.co.tawi.babblesms.server.persistence.items.messageTemplate.MessageTemplateDAO.java
/** * *//*from w w w .j ava2s . c o m*/ @Override public boolean putMessageTemplate(MessageTemplate messageTemplate) { boolean success = true; Connection conn = null; PreparedStatement pstmt = null; try { conn = dbCredentials.getConnection(); pstmt = conn.prepareStatement( "INSERT INTO MessageTemplate (Uuid,title,contents,accountuuid) VALUES (?,?,?,?);"); pstmt.setString(1, messageTemplate.getUuid()); pstmt.setString(2, messageTemplate.getTitle()); pstmt.setString(3, messageTemplate.getContents()); pstmt.setString(4, messageTemplate.getAccountuuid()); System.out.println(messageTemplate); pstmt.execute(); } catch (SQLException e) { logger.error("SQL Exception when trying to put messageTemplate: " + messageTemplate); logger.error(ExceptionUtils.getStackTrace(e)); success = false; } finally { if (pstmt != null) { try { pstmt.close(); } catch (SQLException e) { } } if (conn != null) { try { conn.close(); } catch (SQLException e) { } } } return success; }
From source file:io.stallion.asyncTasks.AsyncTaskDbPersister.java
@Override public boolean markFailed(AsyncTask task, Throwable e) { Log.info("Mark task failed: id={0} handler={1} customKey={2}", task.getId(), task.getHandlerName(), task.getCustomKey());/* w ww . j ava 2s. co m*/ task.setTryCount(task.getTryCount() + 1); task.setErrorMessage(e.toString() + ExceptionUtils.getStackTrace(e)); if (task.getTryCount() >= 5) { task.setFailedAt(DateUtils.mils()); Log.info("Mark task failed permanently: id={0} handler={1} customKey={2}", task.getId(), task.getHandlerName(), task.getCustomKey()); } else { task.setExecuteAt(DateUtils.mils() + ((2 ^ task.getTryCount()) * 1000)); task.setLockedAt(0); task.setLockUuid(""); } persist(task); return true; }