private void handleThrowableFirstLine(OutputStream sw, IThrowableProxy tp, String stackTracePrefix, boolean isRootException) throws IOException { StringBuilder sb = new StringBuilder().append(stackTracePrefix); if (!isRootException) { sb.append(CoreConstants.CAUSED_BY); } sb.append(tp.getClassName()).append(": ").append(tp.getMessage()); sw.write(sb.toString().getBytes()); sw.flush(); }
private static void subjoinExceptionMessage(StringBuilder buf, IThrowableProxy tp) { buf.append(tp.getClassName()).append(": ").append(tp.getMessage()); } }
private void subjoinExceptionMessage(StringBuilder buf, IThrowableProxy tp) { buf.append(tp.getClassName()).append(": ").append(tp.getMessage()); }
public void printFirstLine(StringBuilder sb, IThrowableProxy tp) { int commonFrames = tp.getCommonFrames(); if (commonFrames > 0) { sb.append("<br />").append(CoreConstants.CAUSED_BY); } sb.append(tp.getClassName()).append(": ").append(Transform.escapeTags(tp.getMessage())); sb.append(CoreConstants.LINE_SEPARATOR); }
@InternalApi("Visible for testing") static void writeStack(IThrowableProxy throwProxy, String prefix, StringBuilder payload) { if (throwProxy == null) { return; } payload .append(prefix) .append(throwProxy.getClassName()) .append(": ") .append(throwProxy.getMessage()) .append('\n'); StackTraceElementProxy[] trace = throwProxy.getStackTraceElementProxyArray(); if (trace == null) { trace = new StackTraceElementProxy[0]; } int commonFrames = throwProxy.getCommonFrames(); int printFrames = trace.length - commonFrames; for (int i = 0; i < printFrames; i++) { payload.append(" ").append(trace[i]).append('\n'); } if (commonFrames != 0) { payload.append(" ... ").append(commonFrames).append(" common frames elided\n"); } writeStack(throwProxy.getCause(), "caused by: ", payload); }
public static ThrowableProxyVO build(IThrowableProxy throwableProxy) { if (throwableProxy == null) { return null; } ThrowableProxyVO tpvo = new ThrowableProxyVO(); tpvo.className = throwableProxy.getClassName(); tpvo.message = throwableProxy.getMessage(); tpvo.commonFramesCount = throwableProxy.getCommonFrames(); tpvo.stackTraceElementProxyArray = throwableProxy.getStackTraceElementProxyArray(); IThrowableProxy cause = throwableProxy.getCause(); if (cause != null) { tpvo.cause = ThrowableProxyVO.build(cause); } IThrowableProxy[] suppressed = throwableProxy.getSuppressed(); if (suppressed != null) { tpvo.suppressed = new IThrowableProxy[suppressed.length]; for (int i = 0; i < suppressed.length; i++) { tpvo.suppressed[i] = ThrowableProxyVO.build(suppressed[i]); } } return tpvo; } }
private void handleThrowableFirstLine(OutputStream sw, IThrowableProxy tp, String stackTracePrefix, boolean isRootException) throws IOException { StringBuilder sb = new StringBuilder().append(stackTracePrefix); if (!isRootException) { sb.append(CoreConstants.CAUSED_BY); } sb.append(tp.getClassName()).append(": ").append(tp.getMessage()); sw.write(sb.toString().getBytes()); sw.flush(); }
private static void subjoinExceptionMessage(StringBuilder buf, IThrowableProxy tp) { buf.append(tp.getClassName()).append(": ").append(tp.getMessage()); } }
private void subjoinExceptionMessage(StringBuilder buf, IThrowableProxy tp) { buf.append(tp.getClassName()).append(": ").append(tp.getMessage()); }
public void printFirstLine(StringBuilder sb, IThrowableProxy tp) { int commonFrames = tp.getCommonFrames(); if (commonFrames > 0) { sb.append("<br />").append(CoreConstants.CAUSED_BY); } sb.append(tp.getClassName()).append(": ").append( Transform.escapeTags(tp.getMessage())); sb.append(CoreConstants.LINE_SEPARATOR); }
public static ThrowableProxyVO build(IThrowableProxy throwableProxy) { if(throwableProxy == null) { return null; } ThrowableProxyVO tpvo = new ThrowableProxyVO(); tpvo.className = throwableProxy.getClassName(); tpvo.message = throwableProxy.getMessage(); tpvo.commonFramesCount = throwableProxy.getCommonFrames(); tpvo.stackTraceElementProxyArray = throwableProxy.getStackTraceElementProxyArray(); IThrowableProxy cause = throwableProxy.getCause(); if(cause != null) { tpvo.cause = ThrowableProxyVO.build(cause); } IThrowableProxy[] suppressed = throwableProxy.getSuppressed(); if(suppressed != null) { tpvo.suppressed = new IThrowableProxy[suppressed.length]; for(int i = 0;i<suppressed.length;i++) { tpvo.suppressed[i] = ThrowableProxyVO.build(suppressed[i]); } } return tpvo; } }
private String determineClassName(IThrowableProxy throwable) { if (!useSimpleClassName) { return throwable.getClassName(); } if (throwable instanceof ThrowableProxy) { return ((ThrowableProxy) throwable).getThrowable().getClass().getSimpleName(); } String className = throwable.getClassName(); return className.substring(className.lastIndexOf('.') + 1); }
private void handleThrowableFirstLine(OutputStream sw, IThrowableProxy tp, String stackTracePrefix, boolean isRootException) throws IOException { StringBuilder sb = new StringBuilder().append(stackTracePrefix); if (!isRootException) { sb.append(CoreConstants.CAUSED_BY); } sb.append(tp.getClassName()).append(": ").append(tp.getMessage()); sw.write(sb.toString().getBytes()); sw.flush(); }
private void handleThrowableFirstLine(OutputStream sw, IThrowableProxy tp, String stackTracePrefix, boolean isRootException) throws IOException { StringBuilder sb = new StringBuilder().append(stackTracePrefix); if (!isRootException) { sb.append(CoreConstants.CAUSED_BY); } sb.append(tp.getClassName()).append(": ").append(tp.getMessage()); sw.write(sb.toString().getBytes()); sw.flush(); }
private static Proto.Throwable toProto(IThrowableProxy t) { Proto.Throwable.Builder builder = Proto.Throwable.newBuilder() .setClassName(t.getClassName()); String message = t.getMessage(); if (message != null) { builder.setMessage(message); } for (StackTraceElementProxy element : t.getStackTraceElementProxyArray()) { builder.addStackTraceElement(ErrorMessage.toProto(element.getStackTraceElement())); } builder.setFramesInCommonWithEnclosing(t.getCommonFrames()); IThrowableProxy cause = t.getCause(); if (cause != null) { builder.setCause(toProto(cause)); } for (IThrowableProxy suppressed : t.getSuppressed()) { builder.addSuppressed(toProto(suppressed)); } return builder.build(); } }
@Override protected boolean matchesSafely(IThrowableProxy item) { return exceptionClass.equals(item.getClassName()) && exceptionMessage.matches(item.getMessage().replace(System.lineSeparator(), "")) && item.getStackTraceElementProxyArray().length > 0; } }
static public void printFirstLine(StringBuilder buf, IThrowableProxy tp) { int commonFrames = tp.getCommonFrames(); if (commonFrames > 0) { buf.append(CoreConstants.CAUSED_BY); } buf.append(tp.getClassName()).append(": ").append(tp.getMessage()); } }
public void printFirstLine(StringBuilder sb, IThrowableProxy tp) { int commonFrames = tp.getCommonFrames(); if (commonFrames > 0) { sb.append("<br />").append(CoreConstants.CAUSED_BY); } sb.append(tp.getClassName()).append(": ").append( Transform.escapeTags(tp.getMessage())); sb.append(CoreConstants.LINE_SEPARATOR); }
public void printFirstLine(StringBuilder sb, IThrowableProxy tp) { int commonFrames = tp.getCommonFrames(); if (commonFrames > 0) { sb.append("<br />").append(CoreConstants.CAUSED_BY); } sb.append(tp.getClassName()).append(": ").append( Transform.escapeTags(tp.getMessage())); sb.append(CoreConstants.LINE_SEPARATOR); }
DefaultLogThrowable(IThrowableProxy throwableProxy) { this.className = throwableProxy.getClassName(); this.message = throwableProxy.getMessage(); StackTraceElementProxy[] stackTraceElementProxyArray = throwableProxy.getStackTraceElementProxyArray(); this.stackTraces = new StackTraceElement[stackTraceElementProxyArray.length]; for (int i = 0; i < stackTraceElementProxyArray.length; i++) { stackTraces[i] = stackTraceElementProxyArray[i].getStackTraceElement(); } cause = (throwableProxy.getCause() == null) ? null : new DefaultLogThrowable(throwableProxy.getCause()); }