@Test public void rootCauseEval() { final TestException ex0 = new TestException(); Throwable throwable = new Throwable() { private static final long serialVersionUID = 3597694032723032281L; @Override public synchronized Throwable getCause() { return ex0; } }; CompositeException ex = new CompositeException(throwable); assertSame(ex, ex.getRootCause(ex)); }
Throwable getRootCause(Throwable e) { Throwable root = e.getCause(); if (root == null || cause == root) { return e; } while (true) { Throwable cause = root.getCause(); if (cause == null || cause == root) { return root; } root = cause; } }
CompositeException extends RuntimeException { Throwable getRootCause(Throwable e) { Throwable root = e.getCause(); if (root == null || cause == root) { return e; } while (true) { Throwable cause = root.getCause(); if (cause == null || cause == root) { return root; } root = cause; } } }
CompositeException extends RuntimeException { Throwable getRootCause(Throwable e) { Throwable root = e.getCause(); if (root == null || cause == root) { return e; } while (true) { Throwable cause = root.getCause(); if (cause == null || cause == root) { return root; } root = cause; } } CompositeException(Throwable... exceptions);  CompositeException(Iterable<? extends Throwable> errors); }
CompositeException extends RuntimeException { Throwable getRootCause(Throwable e) { Throwable root = e.getCause(); if (root == null || cause == root) { return e; } while (true) { Throwable cause = root.getCause(); if (cause == null || cause == root) { return root; } root = cause; } } CompositeException(Throwable... exceptions);  CompositeException(Iterable<? extends Throwable> errors); List<Throwable> getExceptions(); @Override String getMessage(); @Override synchronized Throwable getCause(); @Override void printStackTrace(); @Override void printStackTrace(PrintStream s); @Override void printStackTrace(PrintWriter s); int size(); }
CompositeException extends RuntimeException { Throwable getRootCause(Throwable e) { Throwable root = e.getCause(); if (root == null || cause == root) { return e; } while (true) { Throwable cause = root.getCause(); if (cause == null || cause == root) { return root; } root = cause; } } CompositeException(Throwable... exceptions);  CompositeException(Iterable<? extends Throwable> errors); List<Throwable> getExceptions(); @Override String getMessage(); @Override synchronized Throwable getCause(); @Override void printStackTrace(); @Override void printStackTrace(PrintStream s); @Override void printStackTrace(PrintWriter s); int size();  }