From d5e66575e9111290208b30994ff8236a60ed3874 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Thu, 22 Mar 2012 11:26:21 -0700 Subject: [PATCH] Propagate InterruptedException & TimeoutException Previously we passed these exceptions to handler, which wrapped them in a RuntimeException. Instead propagate the actual cause so callers can handle these properly. --- .../concurrent/ExceptionParsingListenableFuture.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/src/main/java/org/jclouds/concurrent/ExceptionParsingListenableFuture.java b/core/src/main/java/org/jclouds/concurrent/ExceptionParsingListenableFuture.java index b8bc83e076..a19eb55ff6 100644 --- a/core/src/main/java/org/jclouds/concurrent/ExceptionParsingListenableFuture.java +++ b/core/src/main/java/org/jclouds/concurrent/ExceptionParsingListenableFuture.java @@ -58,6 +58,8 @@ public class ExceptionParsingListenableFuture implements ListenableFuture public T get() throws InterruptedException, ExecutionException { try { return future.get(); + } catch (InterruptedException ie) { + throw ie; } catch (Exception e) { return attemptConvert(e); } @@ -72,6 +74,10 @@ public class ExceptionParsingListenableFuture implements ListenableFuture public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { try { return future.get(timeout, unit); + } catch (InterruptedException ie) { + throw ie; + } catch (TimeoutException te) { + throw te; } catch (Exception e) { return attemptConvert(e); }