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) {
79
79
Exceptions .throwIfFatal (e );
80
80
RxJavaPlugins .onError (new CompositeException (t , e ));
81
81
}
82
+ } else {
83
+ RxJavaPlugins .onError (t );
82
84
}
83
85
}
84
86
Original file line number Diff line number Diff line change 15
15
16
16
import static org .junit .Assert .*;
17
17
18
+ import java .io .IOException ;
18
19
import java .util .*;
19
20
20
21
import io .reactivex .internal .functions .Functions ;
@@ -363,4 +364,32 @@ public void customOnErrorShouldReportCustomOnError() {
363
364
364
365
assertTrue (o .hasCustomOnError ());
365
366
}
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
+ }
366
395
}
You can’t perform that action at this time.
0 commit comments