Do not unpack ExecutionException when propagating Throwable
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/bba778be Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/bba778be Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/bba778be Branch: refs/heads/0.5.0 Commit: bba778be40a27473d6a62f8008992f744a6a6fa3 Parents: f7ac179 Author: Andrew Kennedy <[email protected]> Authored: Fri Apr 19 11:52:45 2013 +0100 Committer: Andrew Kennedy <[email protected]> Committed: Fri Apr 19 11:52:45 2013 +0100 ---------------------------------------------------------------------- core/src/main/java/brooklyn/util/exceptions/Exceptions.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/bba778be/core/src/main/java/brooklyn/util/exceptions/Exceptions.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/brooklyn/util/exceptions/Exceptions.java b/core/src/main/java/brooklyn/util/exceptions/Exceptions.java index e4866c9..0775fba 100644 --- a/core/src/main/java/brooklyn/util/exceptions/Exceptions.java +++ b/core/src/main/java/brooklyn/util/exceptions/Exceptions.java @@ -5,7 +5,6 @@ import static com.google.common.base.Throwables.getCausalChain; import static com.google.common.collect.Iterables.find; import java.util.NoSuchElementException; -import java.util.concurrent.ExecutionException; import com.google.common.base.Throwables; @@ -15,14 +14,11 @@ public class Exceptions { * Propagate a {@link Throwable} as a {@link RuntimeException}. * <p> * Like Guava {@link Throwables#propagate(Throwable)} but throws {@link RuntimeInterruptedException} - * to handle {@link InterruptedException}s and unpacks the {@link Exception#getCause() cause} and propagates - * it for {@link ExecutionException}s. + * to handle {@link InterruptedException}s. */ public static RuntimeException propagate(Throwable throwable) { if (throwable instanceof InterruptedException) throw new RuntimeInterruptedException((InterruptedException) throwable); - if (throwable instanceof ExecutionException) - return Throwables.propagate(throwable.getCause()); return Throwables.propagate(throwable); } @@ -35,8 +31,6 @@ public class Exceptions { public static void propagateIfFatal(Throwable throwable) { if (throwable instanceof InterruptedException) throw new RuntimeInterruptedException((InterruptedException) throwable); - if (throwable instanceof ExecutionException) - propagateIfFatal(throwable.getCause()); if (throwable instanceof Error) throw (Error) throwable; }
