@Test public void testExceptionCause() { Exception e1 = new Exception("root"); Exception e2 = new Exception("child1", e1); Exception e3 = new Exception("child2", e2); assertEquals("root", ExceptionUtils.getRootCause(e3).getMessage()); }
public static Throwable getRootCause(Throwable throwable) { final List<Throwable> list = getThrowableList(throwable); return list.size() < 2 ? null : list.get(list.size() - 1); }
ExceptionUtils { public static Throwable getRootCause(Throwable throwable) { final List<Throwable> list = getThrowableList(throwable); return list.size() < 2 ? null : list.get(list.size() - 1); } }
ExceptionUtils { public static Throwable getRootCause(Throwable throwable) { final List<Throwable> list = getThrowableList(throwable); return list.size() < 2 ? null : list.get(list.size() - 1); } private  ExceptionUtils(); }
ExceptionUtils { public static Throwable getRootCause(Throwable throwable) { final List<Throwable> list = getThrowableList(throwable); return list.size() < 2 ? null : list.get(list.size() - 1); } private  ExceptionUtils(); static Throwable getRootCause(Throwable throwable); static List<Throwable> getThrowableList(Throwable throwable); static void checkInterrupt(Exception e); static Exception unwrapInvoke(Exception e); static RuntimeException runtimeException(Exception e); static boolean hasInterruptedCause(Throwable e); static boolean isInterrupted(Throwable t); }
ExceptionUtils { public static Throwable getRootCause(Throwable throwable) { final List<Throwable> list = getThrowableList(throwable); return list.size() < 2 ? null : list.get(list.size() - 1); } private  ExceptionUtils(); static Throwable getRootCause(Throwable throwable); static List<Throwable> getThrowableList(Throwable throwable); static void checkInterrupt(Exception e); static Exception unwrapInvoke(Exception e); static RuntimeException runtimeException(Exception e); static boolean hasInterruptedCause(Throwable e); static boolean isInterrupted(Throwable t);  }