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.screen.dashboard.action.DashboardAJAXAction.java
@Override public String execute() throws Exception { try {//from w ww. ja v a 2 s . c o m Locale locale = (Locale) session.get(Constants.LOCALE_KEY); TDashboardFieldBean dashboardItem = (TDashboardFieldBean) DashboardFieldRuntimeBL.getInstance() .loadField(dashboardID); IPluginDashboard plugin = DashboardUtil.getPlugin(dashboardItem); Map<String, String> configParamsMap = dashboardItem.getParametres(); if (locale != null) { configParamsMap.put(BasePluginDashboardView.CONFIGURATION_PARAMS.LOCALE_STRING, locale.toString()); } String jsonData = plugin.createJsonData(dashboardID, session, configParamsMap, projectID, releaseID, params); try { JSONUtility.prepareServletResponseJSON(ServletActionContext.getResponse()); PrintWriter out = ServletActionContext.getResponse().getWriter(); StringBuilder sb = new StringBuilder(); sb.append("{"); JSONUtility.appendBooleanValue(sb, JSONUtility.JSON_FIELDS.SUCCESS, true); JSONUtility.appendJSONValue(sb, "data", jsonData, true); sb.append("}"); out.println(sb); } catch (IOException e) { LOGGER.error(ExceptionUtils.getStackTrace(e)); } } catch (Exception e) { LOGGER.error(ExceptionUtils.getStackTrace(e)); JSONUtility.encodeJSONFailure(ServletActionContext.getResponse(), e.getMessage(), 1); } return null; }
From source file:com.aurel.track.fieldType.bulkSetters.RichTextBulkSetter.java
/** * Sets the workItemBean's attribute depending on the value and bulkRelation * @param workItemBean//from w w w . jav a 2 s. co m * @param fieldID * @param parameterCode * @param bulkTranformContext * @param selectContext * @param value * @return ErrorData if an error is found */ @Override public ErrorData setWorkItemAttribute(TWorkItemBean workItemBean, Integer fieldID, Integer parameterCode, BulkTranformContext bulkTranformContext, SelectContext selectContext, Object value) { if (getRelation() == BulkRelations.SET_NULL) { workItemBean.setAttribute(fieldID, parameterCode, null); return null; } String strValue = null; try { strValue = (String) value; } catch (Exception e) { LOGGER.info("Getting the string value for " + value + " failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } switch (getRelation()) { case BulkRelations.SET_TO: case BulkRelations.ADD_COMMENT: workItemBean.setAttribute(fieldID, parameterCode, strValue); break; case BulkRelations.ADD_TEXT_TO_BEGIN: if (strValue != null) { String originalValue = (String) workItemBean.getAttribute(fieldID, parameterCode); if (originalValue != null) { String newValue = strValue + " " + originalValue; workItemBean.setAttribute(fieldID, parameterCode, newValue); } else { workItemBean.setAttribute(fieldID, parameterCode, strValue); } } break; case BulkRelations.ADD_TEXT_TO_END: if (strValue != null) { String originalValue = (String) workItemBean.getAttribute(fieldID, parameterCode); if (originalValue != null) { String newValue = originalValue + " " + strValue; workItemBean.setAttribute(fieldID, parameterCode, newValue); } else { workItemBean.setAttribute(fieldID, parameterCode, strValue); } } break; case BulkRelations.REMOVE_HTML_TEXT: if (strValue != null) { String originalValue = (String) workItemBean.getAttribute(fieldID, parameterCode); if (originalValue != null) { workItemBean.setAttribute(fieldID, parameterCode, originalValue.replaceAll(strValue, "")); } } break; } return null; }
From source file:com.aurel.track.persist.TFieldConfigPeer.java
/** * Loads the field config by primary key * @param objectID//ww w.jav a2 s . c o m * @return */ @Override public TFieldConfigBean loadByPrimaryKey(Integer objectID) { TFieldConfig tFieldConfig = null; try { tFieldConfig = retrieveByPK(objectID); } catch (Exception e) { LOGGER.warn("Loading of a field config by primary key " + objectID + " failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } if (tFieldConfig != null) { return tFieldConfig.getBean(); } return null; }
From source file:com.aurel.track.vc.action.VersionControlConfigAction.java
@Override public String execute() { List versionControlDescriptors = VersionControlBL.getVersionControlPlugins(); VersionControlTO vcTO = VersionControlBL.loadVersionControl(projectID); StringBuilder sb = new StringBuilder(); sb.append("{"); JSONUtility.appendBooleanValue(sb, JSONUtility.JSON_FIELDS.SUCCESS, true); sb.append("data:{"); JSONUtility.appendJSONValue(sb, "vcPluginList", VersionControlJSON.encodeVersionControlDescriptors(versionControlDescriptors)); String vcType = null;//ww w . j a v a 2 s .c o m boolean useVC = false; if (vcTO != null) { vcType = vcTO.getVersionControlType(); useVC = vcTO.isUseVersionControl(); } JSONUtility.appendStringValue(sb, "vc.versionControlType", vcType); JSONUtility.appendBooleanValue(sb, "vc.useVersionControl", useVC); JSONUtility.appendIntegerValue(sb, "projectID", projectID); sb.append("}}"); try { JSONUtility.prepareServletResponseJSON(ServletActionContext.getResponse()); PrintWriter out = ServletActionContext.getResponse().getWriter(); out.println(sb); } catch (IOException e) { // TODO Auto-generated catch block LOGGER.error(ExceptionUtils.getStackTrace(e)); } return null; }
From source file:com.aurel.track.screen.dashboard.action.DashboardTabRuntime.java
@Override public String execute() { TPersonBean user = (TPersonBean) session.get(Constants.USER_KEY); panels = null;/*w ww . j av a 2 s . c o m*/ //ensure user DashboardPanelRuntimeBL dashboardPanelRuntimeBL = new DashboardPanelRuntimeBL(); dashboardPanelRuntimeBL.setUser(user); dashboardPanelRuntimeBL.setSession(session); dashboardPanelRuntimeBL.setProjectID(projectID); dashboardPanelRuntimeBL.setReleaseID(releaseID); Locale locale = (Locale) session.get(Constants.LOCALE_KEY); TDashboardTabBean tab = (TDashboardTabBean) DashboardTabRuntimeBL.getInstance().loadFullTab(tabID); dashboardPanelRuntimeBL.calculateFieldWrappers(tab); session.put(DashboardAction.LAST_SELECTED_DASHBOARD_TAB, tabID); try { JSONUtility.prepareServletResponseJSON(ServletActionContext.getResponse()); PrintWriter out = ServletActionContext.getResponse().getWriter(); StringBuilder sb = new StringBuilder(); sb.append("{"); JSONUtility.appendBooleanValue(sb, JSON_FIELDS.SUCCESS, true); if (tab != null) { sb.append("\"data\":"); sb.append(new DashboardScreenRuntimeJSON().encodeTab(tab)); } sb.append("}"); out.println(sb); } catch (IOException e) { LOGGER.error(ExceptionUtils.getStackTrace(e)); } return null; }
From source file:jp.co.ipublishing.esnavi.impl.alert.AlertStore.java
/** * ??/*w w w. j a va 2 s . c o m*/ * * @return */ @Nullable private Alert restoreLatestAlert() { final String string = getPreferences(mContext).getString(KEY_LATEST_ALERT, null); if (string != null) { try { return (Alert) Base64.decodeToObject(string); } catch (IOException | ClassCastException | ClassNotFoundException e) { Log.e(TAG, ExceptionUtils.getStackTrace(e)); return null; } } else { return null; } }
From source file:com.aurel.track.persist.THistoryTransactionPeer.java
/** * Loads a HistoryTransactionBean by primary key * @param objectID/* w ww .ja v a 2 s.co m*/ * @return */ @Override public THistoryTransactionBean loadByPrimaryKey(Integer objectID) { THistoryTransaction tHistoryTransaction = null; try { tHistoryTransaction = retrieveByPK(objectID); } catch (Exception e) { LOGGER.warn("Loading of a history transaction by primary key " + objectID + " failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } if (tHistoryTransaction != null) { return tHistoryTransaction.getBean(); } return null; }
From source file:com.braffdev.server.core.io.logger.Logger.java
/** * Logs the given Throwable with the <code>DEBUG</code> tag.<br> * This log will only be printed if debug-level logging is enabled. * * @param t//from w w w . j a va2 s.c o m */ public void debug(Throwable t) { if (Logger.isLogDebug()) { this.buildLogMessage("DEBUG", ExceptionUtils.getStackTrace(t)); } }
From source file:com.aurel.track.persist.TOptionPeer.java
/** * Loads an option by primary key//from ww w .j a v a 2s .c om * @param objectID * @return */ @Override public TOptionBean loadByPrimaryKey(Integer objectID) { TOption tOption = null; try { tOption = retrieveByPK(objectID); } catch (Exception e) { LOGGER.info("Loading of an option by primary key " + objectID + " failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } if (tOption != null) { return tOption.getBean(); } return null; }
From source file:com.aurel.track.exchange.track.importer.ImporterDropdownParser.java
public SortedMap<String, List<ISerializableLabelBean>> parse(File xml, Map<Integer, Integer> fieldMatcher) { this.fieldMatcher = fieldMatcher; //get a factory SAXParserFactory spf = SAXParserFactory.newInstance(); try {//from w w w . j a v a2 s. com //get a new instance of parser SAXParser sp = spf.newSAXParser(); //parse the file and also register this class for call backs LOGGER.debug("Dropdown parser started..."); sp.parse(xml, this); LOGGER.debug("Dropdown parser done"); return externalDropdowns; } catch (SAXException se) { LOGGER.error(ExceptionUtils.getStackTrace(se)); } catch (ParserConfigurationException pce) { LOGGER.error(ExceptionUtils.getStackTrace(pce)); } catch (IOException ie) { LOGGER.error(ExceptionUtils.getStackTrace(ie)); } return null; }