/** * Reset the stacktrace of this Runnable to this point. To be called right before the runnable is * scheduled to another thread, in case it was instantiated ahead of time with a different code * flow. */ public void resetTrace() { mTracingThrowable.fillInStackTrace(); }
/** * Constructs a new {@code Throwable} with the current stack trace and the * given detail message. */ public Throwable(String detailMessage) { this.detailMessage = detailMessage; this.stackTrace = EmptyArray.STACK_TRACE_ELEMENT; fillInStackTrace(); }
/** * Constructs a new {@code Throwable} with the current stack trace, the * given detail message and cause. */ public Throwable(String detailMessage, Throwable cause) { this.detailMessage = detailMessage; this.cause = cause; this.stackTrace = EmptyArray.STACK_TRACE_ELEMENT; fillInStackTrace(); }
/** * Constructs a new {@code Throwable} that includes the current stack trace. */ public Throwable() { this.stackTrace = EmptyArray.STACK_TRACE_ELEMENT; fillInStackTrace(); }
private CString(List<Character> data2, int currentStart) { this.data2 = data2; this.currentStart = currentStart; this.uid = UID; UID += 2; creation.fillInStackTrace(); }
/** * Constructs a new {@code Throwable} with the current stack trace and the * given cause. */ public Throwable(Throwable cause) { this.detailMessage = cause == null ? null : cause.toString(); this.cause = cause; this.stackTrace = EmptyArray.STACK_TRACE_ELEMENT; fillInStackTrace(); }
RealMoveable(RealLine line, String name) { super(line); this.name = name; this.creationPoint = new Throwable(); this.creationPoint.fillInStackTrace(); }
public PositiveForce(Real fixedPoint, RealMoveable movingPoint, double minimunDistance) { if (fixedPoint == movingPoint) { throw new IllegalArgumentException(); } this.fixedPoint = fixedPoint; this.movingPoint = movingPoint; this.minimunDistance = minimunDistance; this.creationPoint = new Throwable(); this.creationPoint.fillInStackTrace(); }
RealMax(Collection<Real> reals) { super(line(reals)); this.all.addAll(reals); this.creationPoint = new Throwable(); this.creationPoint.fillInStackTrace(); }
public static PSystemVersion createDumpStackTrace() throws IOException { final List<String> strings = new ArrayList<String>(); final Throwable creationPoint = new Throwable(); creationPoint.fillInStackTrace(); for (StackTraceElement ste : creationPoint.getStackTrace()) { strings.add(ste.toString()); } return new PSystemVersion(false, strings); }
public Object answer(InvocationOnMock invocation) throws Throwable { if (throwable == null) { throw new IllegalStateException("throwable is null: " + "you shall not call #answer if #validateFor fails!"); } if (MockUtil.isMock(throwable)) { throw throwable; } Throwable t = throwable.fillInStackTrace(); if (t == null) { //Custom exceptions sometimes return null, see #866 throw throwable; } filter.filter(t); throw t; }
try { Throwable throwable = new Throwable(); throwable.fillInStackTrace(); StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter( stringWriter );
/** * Formats the caller's provided message and prepends useful info like * calling thread ID and method name. */ private static String buildMessage(String format, Object... args) { String msg = (args == null) ? format : String.format(Locale.US, format, args); StackTraceElement[] trace = new Throwable().fillInStackTrace().getStackTrace(); String caller = "<unknown>"; // Walk up the stack looking for the first caller outside of VolleyLog. // It will be at least two frames up, so start there. for (int i = 2; i < trace.length; i++) { Class<?> clazz = trace[i].getClass(); if (!clazz.equals(VolleyLog.class)) { String callingClass = trace[i].getClassName(); callingClass = callingClass.substring(callingClass.lastIndexOf('.') + 1); callingClass = callingClass.substring(callingClass.lastIndexOf('$') + 1); caller = callingClass + "." + trace[i].getMethodName(); break; } } return String.format(Locale.US, "[%d] %s: %s", Thread.currentThread().getId(), caller, msg); }
/** * Formats the caller's provided message and prepends useful info like * calling thread ID and method name. */ private static String buildMessage(String format, Object... args) { String msg = (args == null) ? format : String.format(Locale.US, format, args); StackTraceElement[] trace = new Throwable().fillInStackTrace().getStackTrace(); String caller = "<unknown>"; // Walk up the stack looking for the first caller outside of VolleyLog. // It will be at least two frames up, so start there. for (int i = 2; i < trace.length; i++) { Class<?> clazz = trace[i].getClass(); if (!clazz.equals(VolleyLog.class)) { String callingClass = trace[i].getClassName(); callingClass = callingClass.substring(callingClass.lastIndexOf('.') + 1); callingClass = callingClass.substring(callingClass.lastIndexOf('$') + 1); caller = callingClass + "." + trace[i].getMethodName(); break; } } return String.format(Locale.US, "[%d] %s: %s", Thread.currentThread().getId(), caller, msg); }
private static String getDebugInfo() { final Throwable t = new Throwable(); t.fillInStackTrace(); final StackTraceElement[] stackTrace = t.getStackTrace(); if (stackTrace == null) { return null; } final StringBuilder dump = new StringBuilder(); int firstEntitySqlDaoCall = 0; String className; for (int i = 0; i < stackTrace.length; i++) { className = stackTrace[i].getClassName(); if (className.startsWith("org.killbill.billing.util.entity.dao.EntitySqlDaoTransactionalJdbiWrapper")) { firstEntitySqlDaoCall = i; } } final int j = 1 + firstEntitySqlDaoCall; dump.append(stackTrace[j].getClassName()).append(".").append(stackTrace[j].getMethodName()).append("("). append(stackTrace[j].getFileName()).append(":").append(stackTrace[j].getLineNumber()).append(")"); return dump.toString(); } }
public Object answer(InvocationOnMock invocation) throws Throwable { Throwable throwable = (Throwable) ObjenesisHelper.newInstance(throwableClass); throwable.fillInStackTrace(); filter.filter(throwable); throw throwable; }
@Override double getCurrentValueInternal() { double result = all.get(0).getCurrentValue(); for (int i = 1; i < all.size(); i++) { Throwable t = new Throwable(); t.fillInStackTrace(); final int stackLength = t.getStackTrace().length; if (stackLength > 1000) { System.err.println("The faulty RealMax " + getName()); System.err.println("has been created here:"); printCreationStackTrace(); throw new IllegalStateException("Infinite recursion?"); } final double v = all.get(i).getCurrentValue(); if (v > result) { result = v; } } return result; }
public Object answer(InvocationOnMock invocation) throws Throwable { if (new MockUtil().isMock(throwable)) { throw throwable; } Throwable t = throwable.fillInStackTrace(); filter.filter(t); throw t; }
@Override public synchronized Throwable fillInStackTrace() { return getCause() != null ? getCause().fillInStackTrace() : super.fillInStackTrace(); }
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { try { if (control.getState() instanceof RecordState) { LastControl.reportLastControl(control); } return control.getState().invoke(new Invocation(proxy, method, args)); } catch (RuntimeExceptionWrapper e) { throw e.getRuntimeException().fillInStackTrace(); } catch (AssertionErrorWrapper e) { throw e.getAssertionError().fillInStackTrace(); } catch (ThrowableWrapper t) { throw t.getThrowable().fillInStackTrace(); } // then let all unwrapped exceptions pass unmodified }