List of usage examples for java.lang StackTraceElement toString
public String toString()
From source file:fr.putnami.pwt.core.service.server.service.AbstractCommandExecutor.java
protected Throwable toThrown(String message, Throwable source) { CommandException thrown = new CommandException(message, source); if (source != null) { StringBuilder buf = new StringBuilder(); for (StackTraceElement element : source.getStackTrace()) { buf.append(element.toString()).append("\n"); }//from ww w .j av a 2 s. co m thrown.setCauseStackTrace(buf.toString()); } return thrown; }
From source file:sh.calaba.driver.net.FailedWebDriverLikeResponse.java
private void writeExceptionResponse(Exception e, String extraMessage) { try {/*from w ww . ja va 2s. com*/ JSONObject value = new JSONObject(); value.put("message", extraMessage + " , " + e.getMessage()); value.put("class", e.getClass().getCanonicalName()); JSONArray stacktace = new JSONArray(); for (StackTraceElement el : e.getStackTrace()) { stacktace.put(el.toString()); } value.put("stacktrace", stacktace); setValue(value); } catch (JSONException e1) { throw new CalabashException("Error creating JSONObject.", e1); } }
From source file:br.com.mv.modulo.utils.ModuloEmailSender.java
public void sendException(Exception exception) { StringBuilder str = new StringBuilder(); str.append("Erro: " + exception.toString() + System.lineSeparator()); str.append("Mensagem: " + exception.getLocalizedMessage() + System.lineSeparator()); str.append("Stack: " + System.lineSeparator()); for (StackTraceElement element : exception.getStackTrace()) { str.append(element.toString() + System.lineSeparator()); }//from w w w . j a v a 2 s . com sendEmail(str.toString()); }
From source file:org.openqa.selendroid.server.Response.java
public Response(String sessionId, int status, Exception e) throws JSONException { JSONObject errorValue = new JSONObject(); errorValue.put("message", e.getMessage()); errorValue.put("class", e.getClass().getCanonicalName()); JSONArray stacktace = new JSONArray(); for (StackTraceElement el : e.getStackTrace()) { stacktace.put(el.toString()); }//w w w.j a v a2 s . com errorValue.put("stacktrace", stacktace); this.value = errorValue; this.sessionId = sessionId; this.status = status; }
From source file:com.restservice.dto.Envelope.java
public void setStacktrace(StackTraceElement[] stacktrace) { String message = ""; for (StackTraceElement element : stacktrace) { message += element.toString() + "\n"; }/*from w w w. ja va 2 s . c o m*/ this.stacktrace = message; }
From source file:nl.gridline.zieook.exceptions.ZieOokExceptionMapper.java
private ResponseBuilder getResponseBuilder(int status, Exception exception) { ResponseBuilder responseBuilder = Response.status(status); responseBuilder.type(MediaType.TEXT_HTML); StringBuilder b = new StringBuilder(); b.append("<html><head><title>").append(exception.getClass().getCanonicalName()) .append("</title></head><body>"); b.append("<b>CODE</b>\t").append(status).append("<br />\n"); b.append("<b>CLASS</b>\t").append(exception.getClass().getCanonicalName()).append("<br />\n"); b.append("<b>MESSAGE</b>:\t<span style='color:red'>").append(exception.getMessage()) .append("</span><br />\n"); b.append("<b>STACKTRACE</b><br />\t\n"); if (LOG.isDebugEnabled()) { StackTraceElement[] ste = exception.getStackTrace(); for (StackTraceElement s : ste) { b.append(s.toString()).append("<br />\n"); }//from w ww . j a v a 2 s.c o m b.append("end<br />"); } b.append("</body></html>"); return responseBuilder.entity(b.toString()); }
From source file:org.modeshape.web.jcr.rest.model.RestException.java
/** * Creates a new exception, based on an existing {@link Throwable} * * @param t a {@code non-null} {@link Exception} */// w w w .ja v a 2 s . c om public RestException(Throwable t) { this.message = t.getMessage(); StringWriter stringWriter = new StringWriter(); for (StackTraceElement trace : t.getStackTrace()) { stringWriter.append(trace.toString()); } this.stackTrace = stringWriter.toString(); }
From source file:de.micromata.genome.util.jdbc.TraceCreationBasicDataSource.java
/** * //from ww w . ja va 2 s .com * @return null if no open connections */ public String getOpenConnectionsDump() { if (allocatedStacks.isEmpty() == true) { return null; } StringBuilder sb = new StringBuilder(); sb.append("\n Open Connections: " + allocatedStacks.size()).append(":\n"); for (Map.Entry<Connection, StackTraceElement[]> me : allocatedStacks.entrySet()) { sb.append("\n").append(me.getKey()).append("\n"); for (StackTraceElement se : me.getValue()) { sb.append(" ").append(se.toString()).append("\n"); } } return sb.toString(); }
From source file:de.micromata.genome.logging.LogStacktraceAttribute.java
/** * Skip stacktrace./* ww w. ja v a 2s . c o m*/ * * @param sc the sc * @return true, if successful */ protected boolean skipStacktrace(StackTraceElement sc) { String l = sc.toString(); for (String s : skipLeadingStacktraces) { if (l.startsWith(s) == true) { return true; } } return false; }
From source file:com.github.lynxdb.server.api.http.ErrorResponse.java
private void parseException(Throwable _thrw, StringBuilder _builder) { _builder.append(_thrw.getClass().getName()).append(": ").append(_thrw.getMessage()); for (StackTraceElement ste : _thrw.getStackTrace()) { _builder.append("\t").append(ste.toString()).append("\n"); }/* w w w. java 2 s. c o m*/ if (_thrw.getCause() != null) { _builder.append("Caused by :"); parseException(_thrw.getCause(), _builder); } }