@Test public void testIteratorWithCauseOnlyOnSecond() { Throwable t2 = new Throwable(); SQLException e1 = new SQLException(); SQLException e2 = new SQLException(t2); e1.setNextException(e2); List<Throwable> list = Lists.newArrayList(e1); assertThat(list.get(0)).isEqualTo(e1); assertThat(list.get(1)).isEqualTo(e2); assertThat(list.get(2)).isEqualTo(t2); }
public void setNextException(SQLException exception) { SQLException curr = this; while (true) { SQLException next = curr.next; if (next == null) { curr.next = exception; return; } curr = next; } }
SQLException extends Exception implements Iterable<Throwable> { public void setNextException(SQLException exception) { SQLException curr = this; while (true) { SQLException next = curr.next; if (next == null) { curr.next = exception; return; } curr = next; } } }
SQLException extends Exception implements Iterable<Throwable> { public void setNextException(SQLException exception) { SQLException curr = this; while (true) { SQLException next = curr.next; if (next == null) { curr.next = exception; return; } curr = next; } } SQLException(String message, @Nullable String sqlState, int errorCode);  SQLException(String message, @Nullable String sqlState);  SQLException(String message);  SQLException();  SQLException(@Nullable Throwable cause);  SQLException(String message, @Nullable Throwable cause);  SQLException(String message, @Nullable String sqlState, @Nullable Throwable cause);  SQLException(String message, @Nullable String sqlState, int errorCode,
            @Nullable Throwable cause); }
SQLException extends Exception implements Iterable<Throwable> { public void setNextException(SQLException exception) { SQLException curr = this; while (true) { SQLException next = curr.next; if (next == null) { curr.next = exception; return; } curr = next; } } SQLException(String message, @Nullable String sqlState, int errorCode);  SQLException(String message, @Nullable String sqlState);  SQLException(String message);  SQLException();  SQLException(@Nullable Throwable cause);  SQLException(String message, @Nullable Throwable cause);  SQLException(String message, @Nullable String sqlState, @Nullable Throwable cause);  SQLException(String message, @Nullable String sqlState, int errorCode,
            @Nullable Throwable cause); @Nullable String getSQLState(); int getErrorCode(); @Nullable SQLException getNextException(); void setNextException(SQLException exception); @Override Iterator<Throwable> iterator(); }
SQLException extends Exception implements Iterable<Throwable> { public void setNextException(SQLException exception) { SQLException curr = this; while (true) { SQLException next = curr.next; if (next == null) { curr.next = exception; return; } curr = next; } } SQLException(String message, @Nullable String sqlState, int errorCode);  SQLException(String message, @Nullable String sqlState);  SQLException(String message);  SQLException();  SQLException(@Nullable Throwable cause);  SQLException(String message, @Nullable Throwable cause);  SQLException(String message, @Nullable String sqlState, @Nullable Throwable cause);  SQLException(String message, @Nullable String sqlState, int errorCode,
            @Nullable Throwable cause); @Nullable String getSQLState(); int getErrorCode(); @Nullable SQLException getNextException(); void setNextException(SQLException exception); @Override Iterator<Throwable> iterator();  }