@Test public void testBlameBankdroidAlreadyToBlame() { Exception e = new Exception(); String before = toStringWithStacktrace(e); ExceptionUtils.blameBankdroid(e); String after = toStringWithStacktrace(e); Assert.assertEquals(before, after); }
public static void blameBankdroid(Throwable exception) { Throwable ultimateCause = getUltimateCause(exception); if (ultimateCause == null) { return; } StackTraceElement[] bankdroidifiedStacktrace = bankdroidifyStacktrace(ultimateCause.getStackTrace()); if (bankdroidifiedStacktrace.length == 0) { return; } if (bankdroidifiedStacktrace.length == ultimateCause.getStackTrace().length) { return; } Throwable fakeCause = cloneException(ultimateCause); if (fakeCause == null) { Timber.w(new RuntimeException( "Unable to bankdroidify exception of class: " + ultimateCause.getClass())); return; } fakeCause.setStackTrace(concatArrays(bankdroidifiedStacktrace, fakeCause.getStackTrace())); ultimateCause.initCause(fakeCause); }
ExceptionUtils { public static void blameBankdroid(Throwable exception) { Throwable ultimateCause = getUltimateCause(exception); if (ultimateCause == null) { return; } StackTraceElement[] bankdroidifiedStacktrace = bankdroidifyStacktrace(ultimateCause.getStackTrace()); if (bankdroidifiedStacktrace.length == 0) { return; } if (bankdroidifiedStacktrace.length == ultimateCause.getStackTrace().length) { return; } Throwable fakeCause = cloneException(ultimateCause); if (fakeCause == null) { Timber.w(new RuntimeException( "Unable to bankdroidify exception of class: " + ultimateCause.getClass())); return; } fakeCause.setStackTrace(concatArrays(bankdroidifiedStacktrace, fakeCause.getStackTrace())); ultimateCause.initCause(fakeCause); } }
ExceptionUtils { public static void blameBankdroid(Throwable exception) { Throwable ultimateCause = getUltimateCause(exception); if (ultimateCause == null) { return; } StackTraceElement[] bankdroidifiedStacktrace = bankdroidifyStacktrace(ultimateCause.getStackTrace()); if (bankdroidifiedStacktrace.length == 0) { return; } if (bankdroidifiedStacktrace.length == ultimateCause.getStackTrace().length) { return; } Throwable fakeCause = cloneException(ultimateCause); if (fakeCause == null) { Timber.w(new RuntimeException( "Unable to bankdroidify exception of class: " + ultimateCause.getClass())); return; } fakeCause.setStackTrace(concatArrays(bankdroidifiedStacktrace, fakeCause.getStackTrace())); ultimateCause.initCause(fakeCause); }  }
ExceptionUtils { public static void blameBankdroid(Throwable exception) { Throwable ultimateCause = getUltimateCause(exception); if (ultimateCause == null) { return; } StackTraceElement[] bankdroidifiedStacktrace = bankdroidifyStacktrace(ultimateCause.getStackTrace()); if (bankdroidifiedStacktrace.length == 0) { return; } if (bankdroidifiedStacktrace.length == ultimateCause.getStackTrace().length) { return; } Throwable fakeCause = cloneException(ultimateCause); if (fakeCause == null) { Timber.w(new RuntimeException( "Unable to bankdroidify exception of class: " + ultimateCause.getClass())); return; } fakeCause.setStackTrace(concatArrays(bankdroidifiedStacktrace, fakeCause.getStackTrace())); ultimateCause.initCause(fakeCause); }  static void blameBankdroid(Throwable exception); }
ExceptionUtils { public static void blameBankdroid(Throwable exception) { Throwable ultimateCause = getUltimateCause(exception); if (ultimateCause == null) { return; } StackTraceElement[] bankdroidifiedStacktrace = bankdroidifyStacktrace(ultimateCause.getStackTrace()); if (bankdroidifiedStacktrace.length == 0) { return; } if (bankdroidifiedStacktrace.length == ultimateCause.getStackTrace().length) { return; } Throwable fakeCause = cloneException(ultimateCause); if (fakeCause == null) { Timber.w(new RuntimeException( "Unable to bankdroidify exception of class: " + ultimateCause.getClass())); return; } fakeCause.setStackTrace(concatArrays(bankdroidifiedStacktrace, fakeCause.getStackTrace())); ultimateCause.initCause(fakeCause); }  static void blameBankdroid(Throwable exception);  }