You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2019/07/25 20:59:42 UTC

[httpcomponents-core] 04/06: Bug fix: non-blocking i/o event handler may be null in case of an unexpected exception

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch bug-fixes
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git

commit 96d4c321c2ad93ac2ab99ff78b5f18c6966bb7fa
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Thu Jul 25 13:23:23 2019 +0200

    Bug fix: non-blocking i/o event handler may be null in case of an unexpected exception
---
 .../main/java/org/apache/hc/core5/reactor/InternalDataChannel.java  | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalDataChannel.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalDataChannel.java
index 85ef3f8..53b5231 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalDataChannel.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalDataChannel.java
@@ -197,11 +197,13 @@ final class InternalDataChannel extends InternalChannel implements ProtocolIOSes
 
     @Override
     void onException(final Exception cause) {
-        final IOEventHandler handler = ensureHandler();
         if (sessionListener != null) {
             sessionListener.exception(this, cause);
         }
-        handler.exception(this, cause);
+        final IOEventHandler handler = handlerRef.get();
+        if (handler != null) {
+            handler.exception(this, cause);
+        }
     }
 
     void disconnected() {