From 0388b59f007d77f2927f12a457eb4fe60315e144 Mon Sep 17 00:00:00 2001 From: Anton Persson Date: Thu, 22 Mar 2018 13:52:10 +0100 Subject: [PATCH] Don't catch throwable in FusionIndexBase --- .../index/schema/fusion/FusionIndexBase.java | 33 +++---------------- 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/fusion/FusionIndexBase.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/fusion/FusionIndexBase.java index 87665898421c9..ab8d7391b0c4b 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/fusion/FusionIndexBase.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/fusion/FusionIndexBase.java @@ -92,30 +92,7 @@ static R[] instancesAs( T[] instances, Class cls, T @SafeVarargs public static void forAll( ThrowingConsumer 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 ) ); } /** @@ -148,16 +125,16 @@ public static void forAll( ThrowingConsumer 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 ); } } }