Skip to content

Commit

Permalink
[#317] sendUnsolicitedNotification can fail on client disconnect with (
Browse files Browse the repository at this point in the history
…#320)

OnErrorNotImplementedException
  • Loading branch information
vharseko authored Jan 16, 2024
1 parent ab9e136 commit dd18411
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -635,15 +636,21 @@ public void completed(Object result) {
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();
}
}).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
Expand All @@ -653,6 +660,7 @@ public void handleRuntimeException(RuntimeException exception) {
});
}
});

}
}
}

0 comments on commit dd18411

Please sign in to comment.