@Test(timeout = 1000) public void testGetUltimateCauseRecursive() { Exception recursive = new Exception(); Exception intermediate = new Exception(recursive); recursive.initCause(intermediate); Assert.assertNull(ExceptionUtils.getUltimateCause(recursive)); }
@VisibleForTesting @Nullable static Throwable getUltimateCause(Throwable t) { int laps = 0; Throwable ultimateCause = t; while (ultimateCause.getCause() != null) { ultimateCause = ultimateCause.getCause(); if (laps++ > 10) { return null; } } return ultimateCause; }
ExceptionUtils { @VisibleForTesting @Nullable static Throwable getUltimateCause(Throwable t) { int laps = 0; Throwable ultimateCause = t; while (ultimateCause.getCause() != null) { ultimateCause = ultimateCause.getCause(); if (laps++ > 10) { return null; } } return ultimateCause; } }
ExceptionUtils { @VisibleForTesting @Nullable static Throwable getUltimateCause(Throwable t) { int laps = 0; Throwable ultimateCause = t; while (ultimateCause.getCause() != null) { ultimateCause = ultimateCause.getCause(); if (laps++ > 10) { return null; } } return ultimateCause; }  }
ExceptionUtils { @VisibleForTesting @Nullable static Throwable getUltimateCause(Throwable t) { int laps = 0; Throwable ultimateCause = t; while (ultimateCause.getCause() != null) { ultimateCause = ultimateCause.getCause(); if (laps++ > 10) { return null; } } return ultimateCause; }  static void blameBankdroid(Throwable exception); }
ExceptionUtils { @VisibleForTesting @Nullable static Throwable getUltimateCause(Throwable t) { int laps = 0; Throwable ultimateCause = t; while (ultimateCause.getCause() != null) { ultimateCause = ultimateCause.getCause(); if (laps++ > 10) { return null; } } return ultimateCause; }  static void blameBankdroid(Throwable exception);  }