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:android.databinding.tool.util.L.java
public static void d(Throwable t, String msg, Object... args) { if (sEnableDebug) { printMessage(Diagnostic.Kind.NOTE, String.format(msg, args) + " " + ExceptionUtils.getStackTrace(t)); }//from ww w. ja va 2 s . c o m }
From source file:ke.co.tawi.babblesms.server.utils.security.SecurityUtil.java
/** * Return the MD5 hahs of a String. It will work correctly for most * strings. A word which does not work correctly is "michael" (check * against online MD5 hash tools). //from w w w. j a v a 2 s.c o m * * @param toHash plain text string to encryption * @return an md5 hashed string */ public static String getMD5Hash(String toHash) { String md5Hash = ""; try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(toHash.getBytes(), 0, toHash.length()); md5Hash = new BigInteger(1, md.digest()).toString(16); } catch (NoSuchAlgorithmException e) { logger.error("NoSuchAlgorithmException while getting MD5 hash of '" + toHash + "'"); logger.error(ExceptionUtils.getStackTrace(e)); } return md5Hash; }
From source file:com.aurel.track.exchange.UploadHelper.java
/** * Upload the file in a person and type specific directory * @return/* ww w. j av a 2 s.c om*/ */ public static String upload(File uploadFile, String uploadFileFileName, String targetPath, Locale locale, String successResult) { InputStream inputStream; try { inputStream = new FileInputStream(uploadFile); } catch (FileNotFoundException e) { LOGGER.error("Getting the input stream for the uploaded file failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); JSONUtility.encodeJSON(ServletActionContext.getResponse(), JSONUtility.encodeJSONFailure(LocalizeUtil .getLocalizedTextFromApplicationResources("admin.actions.importTp.err.failed", locale))); return null; } UploadHelper.ensureDir(targetPath); File targetFile = new File(targetPath, uploadFileFileName); if (targetFile.exists()) { //if the file exists (as a result of a previous import) then delete it targetFile.delete(); } try { OutputStream outputStream = new FileOutputStream(targetFile); byte[] buf = new byte[1024]; int len; while ((len = inputStream.read(buf)) > 0) { outputStream.write(buf, 0, len); } inputStream.close(); outputStream.close(); } catch (Exception e) { LOGGER.error("Saving the file " + uploadFileFileName + " to the temporary directory " + targetPath + " failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); JSONUtility.encodeJSON(ServletActionContext.getResponse(), JSONUtility.encodeJSONFailure(LocalizeUtil .getLocalizedTextFromApplicationResources("admin.actions.importTp.err.failed", locale))); return null; } return successResult; }
From source file:io.jexiletools.es.SearchResultErrorResult.java
public SearchResultErrorResult(Exception ex) { super((Gson) null); this.setErrorMessage(ExceptionUtils.getStackTrace(ex)); }
From source file:com.aurel.track.admin.customize.scripting.ScriptUtil.java
/** * Read the parameter script line by line * @param content/*from w w w. ja v a 2s.c o m*/ * @return */ public static List<String> getParameterDataLines(String content) { List<String> lines = new ArrayList<String>(); if (content != null) { BufferedReader reader = new BufferedReader(new StringReader(content)); try { String line = null; while ((line = reader.readLine()) != null) { lines.add(line); } } catch (IOException e) { LOGGER.warn("Getting the line failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } finally { try { reader.close(); } catch (IOException e) { LOGGER.warn("Closing the stream failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } } } return lines; }
From source file:com.zuehlke.sbdfx.transport.ResponseWithError.java
private static String calcErrorStacktrace(Throwable error) { return ExceptionUtils.getStackTrace(error); }
From source file:com.andrada.sitracker.util.AnalyticsExceptionParser.java
@NotNull public String getDescription(String p_thread, Throwable p_throwable) { return "Thread: " + p_thread + ", Exception: " + ExceptionUtils.getStackTrace(p_throwable); }
From source file:com.aurel.track.fieldType.runtime.bl.CustomSelectUtil.java
public static Integer[] getSelectedOptions(Object attributeValue) { Integer[] selectedOptionIDs = null; Object[] attributeValues = null; if (attributeValue != null) { try {//from w ww. ja v a 2 s.c o m attributeValues = (Object[]) attributeValue; } catch (Exception e) { LOGGER.warn("The type of the attributeValue source is " + attributeValue.getClass().getName() + ". Casting it to Object[] failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } //clean the null values selectedOptionIDs = getNotNullValues(attributeValues); } return selectedOptionIDs; }
From source file:android.databinding.tool.util.L.java
public static void w(Throwable t, String msg, Object... args) { printMessage(Kind.WARNING, String.format(msg, args) + " " + ExceptionUtils.getStackTrace(t)); }
From source file:com.palantir.docker.compose.connection.waiting.SuccessOrFailure.java
public static SuccessOrFailure fromException(Exception exception) { return SuccessOrFailure.failure("Encountered an exception: " + ExceptionUtils.getStackTrace(exception)); }