File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
main/java/io/reactivex/internal/observers
test/java/io/reactivex/internal/observers Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,8 @@ public void onError(Throwable t) {
7979 Exceptions .throwIfFatal (e );
8080 RxJavaPlugins .onError (new CompositeException (t , e ));
8181 }
82+ } else {
83+ RxJavaPlugins .onError (t );
8284 }
8385 }
8486
Original file line number Diff line number Diff line change 1515
1616import static org .junit .Assert .*;
1717
18+ import java .io .IOException ;
1819import java .util .*;
1920
2021import io .reactivex .internal .functions .Functions ;
@@ -363,4 +364,32 @@ public void customOnErrorShouldReportCustomOnError() {
363364
364365 assertTrue (o .hasCustomOnError ());
365366 }
367+
368+ @ Test
369+ public void disposedObserverShouldReportErrorOnGlobalErrorHandler () {
370+ List <Throwable > errors = TestHelper .trackPluginErrors ();
371+ try {
372+ final List <Throwable > observerErrors = Collections .synchronizedList (new ArrayList <Throwable >());
373+
374+ LambdaObserver <Integer > o = new LambdaObserver <Integer >(Functions .<Integer >emptyConsumer (),
375+ new Consumer <Throwable >() {
376+ @ Override
377+ public void accept (Throwable t ) {
378+ observerErrors .add (t );
379+ }
380+ },
381+ Functions .EMPTY_ACTION ,
382+ Functions .<Disposable >emptyConsumer ());
383+
384+ o .dispose ();
385+ o .onError (new IOException ());
386+ o .onError (new IOException ());
387+
388+ assertTrue (observerErrors .isEmpty ());
389+ TestHelper .assertUndeliverable (errors , 0 , IOException .class );
390+ TestHelper .assertUndeliverable (errors , 1 , IOException .class );
391+ } finally {
392+ RxJavaPlugins .reset ();
393+ }
394+ }
366395}
You can’t perform that action at this time.
0 commit comments