Skip to content
This repository was archived by the owner on Mar 6, 2021. It is now read-only.

Commit 3679a32

Browse files
committed
More fix for AsyncHttpClient#91 Make sure the close survives an error, make sure the close() is getting invoked
1 parent d266d78 commit 3679a32

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/main/java/com/ning/http/client/providers/netty/NettyWebSocket.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,13 @@ protected void onClose() {
143143

144144
protected void onClose(int code, String reason) {
145145
for (WebSocketListener l : listeners) {
146-
if (WebSocketCloseCodeReasonListener.class.isAssignableFrom(l.getClass())) {
147-
WebSocketCloseCodeReasonListener.class.cast(l).onClose(this, code, reason);
148-
} else {
146+
try {
147+
if (WebSocketCloseCodeReasonListener.class.isAssignableFrom(l.getClass())) {
148+
WebSocketCloseCodeReasonListener.class.cast(l).onClose(this, code, reason);
149+
}
149150
l.onClose(this);
151+
} catch (Throwable t) {
152+
l.onError(t);
150153
}
151154
}
152155
}

0 commit comments

Comments
 (0)