From dd1841195f67fc79787673d6c1dbd9ae84306315 Mon Sep 17 00:00:00 2001
From: vharseko <vharseko@3a-systems.ru>
Date: Tue, 16 Jan 2024 14:43:08 +0000
Subject: [PATCH] [#317] sendUnsolicitedNotification can fail on client disconnect with (#320)

---
 opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/LDAPServerFilter.java |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/LDAPServerFilter.java b/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/LDAPServerFilter.java
index a50834d..8aea37d 100644
--- a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/LDAPServerFilter.java
+++ b/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/LDAPServerFilter.java
@@ -84,6 +84,7 @@
 import com.forgerock.reactive.ReactiveHandler;
 import com.forgerock.reactive.Stream;
 
+import io.reactivex.exceptions.OnErrorNotImplementedException;
 import io.reactivex.internal.util.BackpressureHelper;
 
 /**
@@ -635,7 +636,7 @@
             return newCompletable(new Completable.Emitter() {
                 @Override
                 public void subscribe(final Completable.Subscriber s) throws Exception {
-                    promise.thenOnResult(new ResultHandler<Boolean>() {
+                	promise.thenOnResult(new ResultHandler<Boolean>() {
                         @Override
                         public void handleResult(Boolean result) {
                             s.onComplete();
@@ -643,7 +644,13 @@
                     }).thenOnException(new ExceptionHandler<Exception>() {
                         @Override
                         public void handleException(Exception exception) {
-                            s.onError(exception);
+                            try {
+                            	 s.onError(exception);
+                            } catch (Throwable t) {
+                                if (!(t instanceof OnErrorNotImplementedException)) {
+                                    throw t;
+                                }
+                            }
                         }
                     }).thenOnRuntimeException(new RuntimeExceptionHandler() {
                         @Override
@@ -653,6 +660,7 @@
                     });
                 }
             });
+            
         }
     }
 }

--
Gitblit v1.10.0