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:jp.co.ipublishing.esnavi.dependence.shelter.ShelterImageFactory.java
@NonNull @Override//from ww w. j av a2s . co m public Bitmap getPhoto(@NonNull Context context, int shelterId) { try { final InputStream is = context.getResources().getAssets() .open(String.format("shelter_images/%d.jpg", shelterId)); final Bitmap bmp = BitmapFactory.decodeStream(is); is.close(); return bmp; } catch (IOException e) { Log.e(TAG, ExceptionUtils.getStackTrace(e)); } return getNoImageBitmap(context); }
From source file:com.aurel.track.exchange.docx.exporter.AddPageNrToFooter.java
/** * First we create the package and the factory. Then we create the footer. * Finally we add two pages with text to the document and save it. *//*from w w w . j a v a 2 s. c o m*/ static void addFooterWithPageNo(WordprocessingMLPackage wordMLPackage) { ObjectFactory factory = Context.getWmlObjectFactory(); Relationship relationship = null; try { relationship = createFooterPart(wordMLPackage, factory); } catch (InvalidFormatException e) { LOGGER.error("Creating the footer part failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } createFooterReference(wordMLPackage, relationship, factory); }
From source file:it.unibo.alchemist.utils.L.java
/** * @param e//from w w w. j a v a2s . c o m * the Throwable to get and print the stacktrace */ @Deprecated public static void error(final Throwable e) { log(Level.SEVERE, ExceptionUtils.getStackTrace(e)); }
From source file:ch.jamiete.hilda.LogFormat.java
@Override public String format(final LogRecord record) { String log = ""; log += this.sdf.format(new Date(record.getMillis())); log += " [" + record.getLevel().getLocalizedName().toUpperCase() + "]"; if (record.getSourceClassName() != null) { final String[] split = record.getSourceClassName().split("\\."); log += " [" + split[split.length == 1 ? 0 : split.length - 1] + "]"; }/* w ww . ja va 2s.com*/ log += " " + record.getMessage(); if (record.getThrown() != null) { log += System.getProperty("line.separator") + ExceptionUtils.getStackTrace(record.getThrown()); } log += System.getProperty("line.separator"); return log; }
From source file:com.aurel.track.item.action.ItemActionUtil.java
public static IPluginItemAction getPlugin(String className) { if (cachePlugins == null) { cachePlugins = new HashMap(); }/* w ww . ja va 2 s. c om*/ IPluginItemAction plugin = (IPluginItemAction) cachePlugins.get(className); if (plugin != null) { return plugin; } try { plugin = (IPluginItemAction) Class.forName(className).newInstance(); cachePlugins.put(className, plugin); return plugin; } catch (InstantiationException e) { LOGGER.error(ExceptionUtils.getStackTrace(e)); } catch (IllegalAccessException e) { LOGGER.error(ExceptionUtils.getStackTrace(e)); } catch (ClassNotFoundException e) { LOGGER.error(ExceptionUtils.getStackTrace(e)); } return null;//plugin class problem }
From source file:com.aurel.track.exchange.docx.exporter.LaTeXExportBL.java
/** * Serializes the docx content into the response's output stream * @param response/*from w ww . j a va 2s .co m*/ * @param wordMLPackage * @return */ 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)); OutputStream outputStream = null; try { 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)); } return null; }
From source file:com.daou.terracelicense.controller.MachineController.java
/** * Machine-Controller-01/*from ww w . j av a 2 s.co m*/ * Get Machine List View */ @RequestMapping(value = "/view/list", method = RequestMethod.GET) public ModelAndView getMachineListView(Model model) { MachineList machineList = new MachineList(); try { machineList = machineService.getMachineList(INIT_PAGE, INIT_SORT_TYPE); } catch (Exception e) { logger.error(ExceptionUtils.getStackTrace(e)); } ModelAndView mav = new ModelAndView("machine/list", model.asMap()); mav.addObject("machineList", machineList); return mav; }
From source file:com.aurel.track.persist.TVersionControlParameterPeer.java
public static void deleteByProject(Integer projectID, Connection con) { Criteria crit = new Criteria(); crit.add(PROJECT, projectID);/* w w w. j a v a2 s.c o m*/ try { doDelete(crit, con); } catch (TorqueException e) { LOGGER.debug(ExceptionUtils.getStackTrace(e)); } }
From source file:com.aurel.track.persist.TSite.java
@Override public void save() { try {/*from w w w. jav a2 s.c o m*/ LOGGER.debug(this.toString()); super.save(); } catch (Exception e) { LOGGER.error("Saving the TSite object failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } }
From source file:com.trenako.web.controllers.ErrorController.java
@RequestMapping(value = "/server-error") public ModelAndView resolveException(HttpServletRequest request) { Exception ex = (Exception) request.getAttribute("javax.servlet.error.exception"); LogUtils.logException(log, ex);/* w ww .j a va 2 s.c o m*/ if (isLocalhost(request)) { String error = ExceptionUtils.getStackTrace(ex); ModelAndView debugView = new ModelAndView("error/debug"); debugView.addObject("error", error); debugView.addObject("request", request); return debugView; } else { return new ModelAndView("error/error"); } }