@Override public boolean hasNext() { try { return it.hasNext(); } catch ( Throwable t ) { return exceptionOnHasNext( t ); } }
return exceptionOnIterator( t );
@Override public T next() { try { return it.next(); } catch ( Throwable t ) { return exceptionOnNext( t ); } }
@Override protected void exceptionOnRemove( Throwable t ) { super.exceptionOnRemove( t ); }
protected boolean exceptionOnHasNext( Throwable t ) { rethrow( t ); return false; }
protected void rethrow( Throwable t ) { // TODO it's pretty bad that we have to do this. We should refactor our exception hierarchy // to eliminate the need for this hack. ExceptionHandlingIterable.sneakyThrow( t ); }
@Override public void remove() { try { it.remove(); } catch ( Throwable t ) { exceptionOnRemove( t ); } } };
protected T exceptionOnNext( Throwable t ) { rethrow( t ); return null; }
protected void rethrow( Throwable t ) { // TODO it's pretty bad that we have to do this. We should refactor our exception hierarchy // to eliminate the need for this hack. ExceptionHandlingIterable.sneakyThrow( t ); }
@Override protected void exceptionOnRemove( Throwable t ) { super.exceptionOnRemove( t ); }
@Override protected T exceptionOnNext( Throwable t ) { if ( t instanceof Exception ) { rethrow( new BadInputException( t ) ); } return super.exceptionOnNext( t ); }
@Override protected boolean exceptionOnHasNext( Throwable t ) { if ( t instanceof Exception ) { rethrow( new BadInputException( t ) ); } return super.exceptionOnHasNext( t ); } }
@Override protected Iterator<T> exceptionOnIterator( Throwable t ) { if ( t instanceof Exception ) { rethrow( new BadInputException( t ) ); } return super.exceptionOnIterator( t ); }
protected Iterator<T> exceptionOnIterator( Throwable t ) { rethrow( t ); return null; } }
@Override public void remove() { try { it.remove(); } catch ( Throwable t ) { exceptionOnRemove( t ); } } };
@Override public T next() { try { return it.next(); } catch ( Throwable t ) { return exceptionOnNext( t ); } }
@Override public boolean hasNext() { try { return it.hasNext(); } catch ( Throwable t ) { return exceptionOnHasNext( t ); } }
protected T exceptionOnNext( Throwable t ) { rethrow( t ); return null; }
@Override protected T exceptionOnNext( Throwable t ) { if ( t instanceof Exception ) { rethrow( new BadInputException( t ) ); } return super.exceptionOnNext( t ); }