List of usage examples for java.lang StackTraceElement toString
public String toString()
From source file:com.mtomczak.nausicaa.DockingView.java
@Override public void update(JSONObject telemetry) { // TODO(mtomczak): Need to account for all 0s, indicating no docking target // set.//from www. jav a2 s .co m try { double distance = telemetry.getDouble("tar.distance"); double xDistance = telemetry.getDouble("dock.x"); double yDistance = telemetry.getDouble("dock.y"); // TODO(mtomczak): Need better window shading for no selected dock target. // if (xDistance == 0 && yDistance == 0) { // if (alertOutput != null) { // alertOutput.alert("[No docking target selected]"); // } // return; // } double rcsFuelVal = telemetry.getDouble("r.resource[MonoPropellant]"); double rcsFuelMax = telemetry.getDouble("r.resourceMax[MonoPropellant]"); pitchDial.update(telemetry.getDouble("dock.ax")); yawDial.update(telemetry.getDouble("dock.ay")); String output = "\nDistance:\n" + new DecimalFormat("#,###.##").format(distance) + "m"; if (rcsFuelMax > 0) { output += "\n\nRCS fuel:\n" + new DecimalFormat("000.##").format(rcsFuelVal / rcsFuelMax * 100.0) + "%"; } dockData.setText(output); postInvalidate(); } catch (JSONException e) { Log.e("Nausicaa", e.toString()); String trace = ""; for (StackTraceElement el : e.getStackTrace()) { trace += el.toString(); } Log.e("Nausicaa", trace); if (alertOutput != null) { alertOutput.alert("<<PARSE ERROR>>"); } } }
From source file:no.dusken.common.spring.ExceptionHandler.java
private String getStackTraceAsString(StackTraceElement[] stackTrace) { StringBuffer string = new StringBuffer(); for (StackTraceElement ste : stackTrace) { string.append(ste.toString()).append("\r\n"); }/* w w w . j ava2 s. com*/ return string.toString(); }
From source file:io.udvi.amqp.mq.transport.connection.CAMQPConnectionHandler.java
/** * Invoked when an exception was raised by an I/O thread or a * {@link ChannelHandler}.// w ww.j ava2 s. c o m */ @Override public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) { String connectionKey = (connection != null) ? connection.getKey().toString() : StringUtils.EMPTY; log.warn("CAMQPConnectionHandler.exceptionCaught: " + connectionKey); StringBuilder stackTraceInfo = new StringBuilder(); StackTraceElement[] elems = Thread.currentThread().getStackTrace(); for (StackTraceElement elem : elems) { stackTraceInfo.append(elem.toString()).append("\n"); } log.warn(stackTraceInfo.toString()); }
From source file:uk.ac.ebi.atlas.web.controllers.rest.admin.ExperimentAdminController.java
@ExceptionHandler(Exception.class) @ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR) @ResponseBody/*from w w w .ja v a 2 s .c o m*/ public String handleException(Exception e) throws IOException { String lineSeparator = "<br>"; LOGGER.error(e.getMessage(), e); StringBuilder sb = new StringBuilder(); sb.append(e.getClass().getSimpleName()).append(": ").append(e.getMessage()).append(lineSeparator); for (StackTraceElement element : e.getStackTrace()) { sb.append(element.toString()).append(lineSeparator); } return sb.toString(); }
From source file:org.openmrs.web.controller.report.ReportSchemaXmlFormController.java
/** * @see org.springframework.validation.Validator#validate(java.lang.Object, * org.springframework.validation.Errors) */// ww w .j av a2 s .c o m public void validate(Object commandObject, Errors errors) { ValidationUtils.rejectIfEmpty(errors, "xml", "Paste XML for report before saving"); ReportSchemaXml rsx = (ReportSchemaXml) commandObject; try { ReportService reportService = (ReportService) Context.getService(ReportService.class); ReportSchema schema = reportService.getReportSchema(rsx); if (schema == null) throw new NullPointerException(); } catch (Exception ex) { log.warn("Exception building ReportSchema from XML", ex); if (ex.getCause() != null) { Throwable temp = ex.getCause(); while (temp.getCause() != null) { temp = temp.getCause(); } errors.rejectValue("xml", temp.getMessage()); } else { StringBuilder sb = new StringBuilder(); sb.append("Invalid XML content<br/>"); sb.append(ex).append("<br/>"); for (StackTraceElement e : ex.getStackTrace()) sb.append(e.toString()).append("<br/>"); errors.rejectValue("xml", sb.toString()); } } }
From source file:com.opengamma.engine.view.calcnode.MutableExecutionLog.java
public void setException(Throwable exception) { _exceptionClass = exception.getClass().getName(); _exceptionMessage = exception.getMessage(); final StringBuffer buffer = new StringBuffer(); for (StackTraceElement element : exception.getStackTrace()) { buffer.append(element.toString() + "\n"); }// ww w .j a v a 2 s . co m _exceptionStackTrace = buffer.toString(); }
From source file:com.kotcrab.vis.editor.util.CrashReporter.java
private void printThreadInfo() { println("--- Threads ---"); Set<Thread> threadSet = Thread.getAllStackTraces().keySet(); for (Thread t : threadSet) { if (t.isDaemon()) { println("Skipping daemon thread: " + t.getName()); } else {/* ww w . j a va2 s .c o m*/ println("Thread: " + t.getName()); for (StackTraceElement e : t.getStackTrace()) { crashReport.append("\t"); println(e.toString()); } } println(); } println("---------------"); println(); }
From source file:com.opengamma.engine.calcnode.MutableExecutionLog.java
public void setException(Throwable exception) { _exceptionClass = exception.getClass().getName(); _exceptionMessage = exception.getMessage(); final StringBuilder buffer = new StringBuilder(); for (StackTraceElement element : exception.getStackTrace()) { buffer.append(element.toString()).append("\n"); }/*w ww .j av a 2 s . c o m*/ _exceptionStackTrace = buffer.toString(); _logLevels.add(LogLevel.WARN); }
From source file:com.sonatype.nexus.perftest.ClientSwarm.java
public void stop() throws InterruptedException { for (Thread thread : threads) { for (int i = 0; i < 3 && thread.isAlive(); i++) { thread.interrupt();//from w w w . j av a2 s. co m thread.join(1000L); } if (thread.isAlive()) { StringBuilder sb = new StringBuilder( String.format("Thread %s ignored interrupt flag\n", thread.getName())); for (StackTraceElement f : thread.getStackTrace()) { sb.append("\t").append(f.toString()).append("\n"); } System.err.println(sb.toString()); } } }
From source file:org.openmrs.web.controller.report.ReportSchemaXmlFormController.java
/** * @see org.springframework.web.servlet.mvc.SimpleFormController#onSubmit(javax.servlet.http.HttpServletRequest, * javax.servlet.http.HttpServletResponse, java.lang.Object, * org.springframework.validation.BindException) *///from www. j a va 2s . co m @Override protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object commandObject, BindException errors) throws Exception { ReportSchemaXml reportSchemaXml = (ReportSchemaXml) commandObject; ReportService reportService = (ReportService) Context.getService(ReportService.class); try { // create a new object out of their xml in order to verify xml and copy out the id/name/desc ReportSchema schema = reportService.getReportSchema(reportSchemaXml); // if the user changed the reportSchemaId to create a new one, create a new object here // so hibernate doesn't complain if (reportSchemaXml.getReportSchemaId() != null && !schema.getReportSchemaId().equals(reportSchemaXml.getReportSchemaId())) { String xml = reportSchemaXml.getXml(); reportSchemaXml = new ReportSchemaXml(); reportSchemaXml.setXml(xml); } reportSchemaXml.populateFromReportSchema(schema); // save the xml to the database reportService.saveReportSchemaXml(reportSchemaXml); } catch (Exception ex) { log.warn("Exception building ReportSchema from XML", ex); if (ex.getCause() != null) { Throwable temp = ex.getCause(); while (temp.getCause() != null) temp = temp.getCause(); errors.rejectValue("xml", temp.getMessage()); } else { StringBuilder sb = new StringBuilder(); sb.append("Invalid XML content<br/>"); sb.append(ex).append("<br/>"); for (StackTraceElement e : ex.getStackTrace()) sb.append(e.toString()).append("<br/>"); errors.rejectValue("xml", sb.toString()); } return showForm(request, response, errors); } HttpSession httpSession = request.getSession(); httpSession.setAttribute(WebConstants.OPENMRS_MSG_ATTR, "reportingcompatibility.Report.manageSchema.saved"); return new ModelAndView(new RedirectView(getSuccessView())); }