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.track.importer.ImporterFieldParser.java
public List<ISerializableLabelBean> parse(File xml) { //get a factory SAXParserFactory spf = SAXParserFactory.newInstance(); try {// w ww .j av a 2 s .c o m //get a new instance of parser SAXParser sp = spf.newSAXParser(); //parse the file and also register this class for call backs LOGGER.debug("Field parser started..."); sp.parse(xml, this); LOGGER.debug("Field parser done..."); return fieldBeans; } 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; }
From source file:com.aurel.track.util.StringArrayParameterUtils.java
public static Boolean parseBooleanValue(Map<String, String[]> configParameters, String fieldName, Boolean defaultValue) {// ww w .j a v a2 s. c o m Boolean result = defaultValue; String[] strArr = null; 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 = Boolean.valueOf(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.aurel.track.persist.TEmailProcessedPeer.java
@Override public TEmailProcessedBean loadByPrimaryKey(Integer objectID) { TEmailProcessedBean templateBean = null; TEmailProcessed tobject = null;/*w ww .ja v a 2s.com*/ try { tobject = retrieveByPK(objectID); } catch (TorqueException e) { LOGGER.warn( "Loading of a EmailProcessed by primary key " + objectID + " failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } if (tobject != null) { templateBean = tobject.getBean(); } return templateBean; }
From source file:com.aurel.track.lucene.index.associatedFields.textExctractor.RTFExtractor.java
/** * Gets the text from file content /*from w w w. j a v a2 s . co m*/ * @param file * @param fileExtension * @return */ @Override public String getText(File file, String fileExtension) { FileInputStream fis = null; Reader reader = null; try { DefaultStyledDocument dsd = new DefaultStyledDocument(); RTFEditorKit rtfEditorKit = new RTFEditorKit(); try { fis = new FileInputStream(file); } catch (FileNotFoundException e) { LOGGER.info("File " + file.getName() + " not found. " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); return null; } reader = new BufferedReader(new InputStreamReader(fis)); rtfEditorKit.read(reader, dsd, 0); return dsd.getText(0, dsd.getLength()); } catch (Exception e) { if (LOGGER.isDebugEnabled()) { LOGGER.debug( "Extracting text from the .rtf file " + file.getName() + " failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } return null; } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { LOGGER.debug( "Closing the reader for file " + file.getName() + " failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } } if (fis != null) { try { fis.close(); } catch (IOException e) { LOGGER.debug("Closing the FileInputStream for file " + file.getName() + " failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } } } }
From source file:io.jmnarloch.cd.go.plugin.sbt.SbtTaskExecutor.java
/** * {@inheritDoc}/* w w w . ja v a 2s . co m*/ */ @Override public ExecutionResult execute(ExecutionContext context, ExecutionConfiguration config, JobConsoleLogger console) { try { final ProcessBuilder sbt = buildSbtProcess(context, config); int result = execute(sbt, console); if (!isSuccess(result)) { return ExecutionResult.failure(FAILURE); } return ExecutionResult.success(SUCCESS); } catch (Exception e) { logger.error("Build failed with error", e); console.printLine(e.getMessage()); console.printLine(ExceptionUtils.getStackTrace(e)); return ExecutionResult.failure(FAILURE, e); } }
From source file:com.aurel.track.fieldType.runtime.matchers.run.DoubleMatcherRT.java
/** * Whether the value matches or not/*w ww. j a v a 2 s . com*/ * * @param attributeValue * @return */ @Override public boolean match(Object attributeValue) { Boolean nullMatch = nullMatcher(attributeValue); if (nullMatch != null) { return nullMatch.booleanValue(); } if (attributeValue == null || matchValue == null) { return false; } Double attributeValueDouble = null; Double matcherValueDouble = null; try { attributeValueDouble = (Double) attributeValue; } catch (Exception e) { LOGGER.error("Converting the attribute value " + attributeValue + " of type " + attributeValue.getClass().getName() + " to Double failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); return false; } try { matcherValueDouble = (Double) matchValue; } catch (Exception e) { LOGGER.warn("Converting the matcher value " + matchValue + " of type " + matchValue.getClass().getName() + " to Double failed with " + e.getMessage(), e); return false; } switch (relation) { case MatchRelations.EQUAL: return (Double.doubleToRawLongBits(attributeValueDouble.doubleValue()) - Double.doubleToRawLongBits(matcherValueDouble.doubleValue()) == 0); case MatchRelations.NOT_EQUAL: return (Double.doubleToRawLongBits(attributeValueDouble.doubleValue()) - Double.doubleToRawLongBits(matcherValueDouble.doubleValue()) != 0); case MatchRelations.GREATHER_THAN: return attributeValueDouble.doubleValue() > matcherValueDouble.doubleValue(); case MatchRelations.GREATHER_THAN_EQUAL: return attributeValueDouble.doubleValue() >= matcherValueDouble.doubleValue(); case MatchRelations.LESS_THAN: return attributeValueDouble.doubleValue() < matcherValueDouble.doubleValue(); case MatchRelations.LESS_THAN_EQUAL: return attributeValueDouble.doubleValue() <= matcherValueDouble.doubleValue(); default: return false; } }
From source file:com.aurel.track.persist.TMailTemplateDefPeer.java
/** * Loads a mail bean by primary key//from w w w .ja v a2 s . c om * @param objectID * @return */ @Override public TMailTemplateDefBean loadByPrimaryKey(Integer objectID) { TMailTemplateDef tMailTemplateDef = null; try { tMailTemplateDef = retrieveByPK(objectID); } catch (Exception e) { LOGGER.warn( "Loading the mail template def by primary key " + objectID + " failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } if (tMailTemplateDef != null) { return tMailTemplateDef.getBean(); } return null; }
From source file:com.aurel.track.persist.TNavigatorColumnPeer.java
/** * Loads the fields for a layout/*from w w w . j a v a 2 s . c om*/ * @param navigatorLayoutID * @return */ @Override public TNavigatorColumnBean loadByPrimaryKey(Integer navigatorColumnID) { TNavigatorColumn tNavigatorColumn = null; try { tNavigatorColumn = retrieveByPK(navigatorColumnID); } catch (Exception e) { LOGGER.info("Loading of a navigator colum by primary key " + navigatorColumnID + " failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } if (tNavigatorColumn != null) { return tNavigatorColumn.getBean(); } return null; }
From source file:com.aurel.track.persist.TVersionControlParameterPeer.java
public static void saveParameters(Integer projectID, Map params, Connection con) { List oldParams = getByProject(projectID, con); if (oldParams == null) {//in order to avoid nullPointerException oldParams = new ArrayList(); }//from w ww. j ava2 s.c om if (params == null) { for (int i = 0; i < oldParams.size(); i++) { TVersionControlParameter o = (TVersionControlParameter) oldParams.get(i); try { doDelete(SimpleKey.keyFor(o.getObjectID()), con); } catch (TorqueException e) { LOGGER.debug(ExceptionUtils.getStackTrace(e)); } } return; } Iterator it = params.keySet().iterator(); while (it.hasNext()) { String param = (String) it.next(); boolean found = false; for (int i = 0; i < oldParams.size(); i++) { TVersionControlParameter o = (TVersionControlParameter) oldParams.get(i); if (o.getName().equals(param)) { o.setParamValue((String) params.get(param)); found = true; try { o.save(con); } catch (TorqueException e) { LOGGER.debug(ExceptionUtils.getStackTrace(e)); } oldParams.remove(o); break; } } if (found == false) { TVersionControlParameter o = new TVersionControlParameter(); o.setName(param); o.setParamValue((String) params.get(param)); try { o.setProject(projectID); } catch (TorqueException e) { LOGGER.debug(ExceptionUtils.getStackTrace(e)); //To change body of catch statement use File | Settings | File Templates. } try { o.save(con); } catch (TorqueException e) { LOGGER.debug(ExceptionUtils.getStackTrace(e)); } } } //remove old parameters (if exists) for (int i = 0; i < oldParams.size(); i++) { TVersionControlParameter o = (TVersionControlParameter) oldParams.get(i); try { doDelete(SimpleKey.keyFor(o.getObjectID()), con); } catch (TorqueException e) { LOGGER.debug(ExceptionUtils.getStackTrace(e)); } } }
From source file:io.galeb.router.tests.client.JmxClientService.java
@PostConstruct public void start() { try {/*from w w w. j ava 2s .co m*/ String jmxUrl = ConnectorAddressLink.importFrom(Info.getPid()); if (jmxUrl != null) { final JMXServiceURL url = new JMXServiceURL(jmxUrl); final JMXConnector jmxConn = JMXConnectorFactory.connect(url); client = jmxConn.getMBeanServerConnection(); enabled.set(true); } } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug(ExceptionUtils.getStackTrace(e)); } } }