Skip to content

Commit 6cfd1b5

Browse files
author
Stephane Landelle
committed
In case catch Throwable didn't catch everything?
1 parent d87c484 commit 6cfd1b5

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

providers/netty/src/main/java/org/asynchttpclient/providers/netty/NettyResponseFuture.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,9 @@ public V get(long l, TimeUnit tu) throws InterruptedException, TimeoutException,
245245
asyncHandler.onThrowable(te);
246246
} catch (Throwable t) {
247247
logger.debug("asyncHandler.onThrowable", t);
248-
} finally {
249-
cancelReaper();
250-
throw new ExecutionException(te);
251248
}
249+
cancelReaper();
250+
throw new ExecutionException(te);
252251
}
253252
}
254253
isDone.set(true);
@@ -279,10 +278,9 @@ V getContent() throws ExecutionException {
279278
asyncHandler.onThrowable(ex);
280279
} catch (Throwable t) {
281280
logger.debug("asyncHandler.onThrowable", t);
282-
} finally {
283-
cancelReaper();
284-
throw new RuntimeException(ex);
285281
}
282+
cancelReaper();
283+
throw new RuntimeException(ex);
286284
}
287285
}
288286
content.compareAndSet(null, update);
@@ -303,8 +301,8 @@ public final void done() {
303301
} catch (ExecutionException t) {
304302
return;
305303
} catch (RuntimeException t) {
306-
Throwable exception = t.getCause() != null ? t.getCause() : t;
307-
exEx.compareAndSet(null, new ExecutionException(exception));
304+
Throwable exception = t.getCause() != null ? t.getCause() : t;
305+
exEx.compareAndSet(null, new ExecutionException(exception));
308306

309307
} finally {
310308
latch.countDown();
@@ -471,7 +469,8 @@ public void setRequest(Request request) {
471469
}
472470

473471
/**
474-
* Return true if the {@link Future} cannot be recovered. There is some scenario where a connection can be closed by an unexpected IOException, and in some situation we can recover from that exception.
472+
* Return true if the {@link Future} cannot be recovered. There is some scenario where a connection can be closed by an unexpected IOException, and in some situation we can
473+
* recover from that exception.
475474
*
476475
* @return true if that {@link Future} cannot be recovered.
477476
*/

providers/netty4/src/main/java/org/asynchttpclient/providers/netty4/NettyResponseFuture.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,9 @@ public V get(long l, TimeUnit tu) throws InterruptedException, TimeoutException,
230230
asyncHandler.onThrowable(te);
231231
} catch (Throwable t) {
232232
logger.debug("asyncHandler.onThrowable", t);
233-
} finally {
234-
cancelReaper();
235-
throw new ExecutionException(te);
236233
}
234+
cancelReaper();
235+
throw new ExecutionException(te);
237236
}
238237
}
239238
isDone.set(true);
@@ -264,10 +263,9 @@ public V getContent() throws ExecutionException {
264263
asyncHandler.onThrowable(ex);
265264
} catch (Throwable t) {
266265
logger.debug("asyncHandler.onThrowable", t);
267-
} finally {
268-
cancelReaper();
269-
throw new RuntimeException(ex);
270266
}
267+
cancelReaper();
268+
throw new RuntimeException(ex);
271269
}
272270
}
273271
content.compareAndSet(null, update);

0 commit comments

Comments
 (0)