Skip to content

Commit

Permalink
Don't catch throwable in FusionIndexBase
Browse files Browse the repository at this point in the history
  • Loading branch information
burqen committed Mar 22, 2018
1 parent fdfd88a commit 0388b59
Showing 1 changed file with 5 additions and 28 deletions.
Expand Up @@ -92,30 +92,7 @@ static <T,R,E extends Exception> R[] instancesAs( T[] instances, Class<R> cls, T
@SafeVarargs
public static <T, E extends Exception> void forAll( ThrowingConsumer<T,E> consumer, T... subjects ) throws E
{
E exception = null;
for ( T subject : subjects )
{
try
{
consumer.accept( subject );
}
catch ( Throwable t )
{
E e = (E) t;
if ( exception == null )
{
exception = e;
}
else
{
exception.addSuppressed( e );
}
}
}
if ( exception != null )
{
throw exception;
}
forAll( consumer, Arrays.asList( subjects ) );
}

/**
Expand Down Expand Up @@ -148,16 +125,16 @@ public static <T, E extends Exception> void forAll( ThrowingConsumer<T,E> consum
{
consumer.accept( subject );
}
catch ( Throwable t )
catch ( Exception caught )
{
E e = (E) t;
E castedException = (E) caught;
if ( exception == null )
{
exception = e;
exception = castedException;
}
else
{
exception.addSuppressed( e );
exception.addSuppressed( castedException );
}
}
}
Expand Down

0 comments on commit 0388b59

Please sign in to comment.