Skip to content

Commit b717c89

Browse files
authored
2.x: fix CallbackCompletableObserver calling onError, ResourceX wording (#5240)
1 parent 851de41 commit b717c89

File tree

7 files changed

+23
-18
lines changed

7 files changed

+23
-18
lines changed

src/main/java/io/reactivex/internal/observers/CallbackCompletableObserver.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ public void onComplete() {
5252
onComplete.run();
5353
} catch (Throwable ex) {
5454
Exceptions.throwIfFatal(ex);
55-
onError(ex);
56-
return;
55+
RxJavaPlugins.onError(ex);
5756
}
5857
lazySet(DisposableHelper.DISPOSED);
5958
}

src/main/java/io/reactivex/observers/DisposableObserver.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*
2525
* <p>All pre-implemented final methods are thread-safe.
2626
*
27-
* <p>Use the protected {@link #dispose()} to dispose the sequence from within an
27+
* <p>Use the public {@link #dispose()} method to dispose the sequence from within an
2828
* {@code onNext} implementation.
2929
*
3030
* <p>Like all other consumers, {@code DefaultObserver} can be subscribed only once.

src/main/java/io/reactivex/observers/ResourceCompletableObserver.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* <p>Override the protected {@link #onStart()} to perform initialization when this
3030
* {@code ResourceCompletableObserver} is subscribed to a source.
3131
*
32-
* <p>Use the protected {@link #dispose()} to dispose the sequence externally and release
32+
* <p>Use the public {@link #dispose()} method to dispose the sequence externally and release
3333
* all resources.
3434
*
3535
* <p>To release the associated resources, one has to call {@link #dispose()}

src/main/java/io/reactivex/observers/ResourceMaybeObserver.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* <p>Override the protected {@link #onStart()} to perform initialization when this
3434
* {@code ResourceMaybeObserver} is subscribed to a source.
3535
*
36-
* <p>Use the protected {@link #dispose()} to dispose the sequence externally and release
36+
* <p>Use the public {@link #dispose()} method to dispose the sequence externally and release
3737
* all resources.
3838
*
3939
* <p>To release the associated resources, one has to call {@link #dispose()}

src/main/java/io/reactivex/observers/ResourceSingleObserver.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* <p>Override the protected {@link #onStart()} to perform initialization when this
3131
* {@code ResourceSingleObserver} is subscribed to a source.
3232
*
33-
* <p>Use the protected {@link #dispose()} to dispose the sequence externally and release
33+
* <p>Use the public {@link #dispose()} method to dispose the sequence externally and release
3434
* all resources.
3535
*
3636
* <p>To release the associated resources, one has to call {@link #dispose()}

src/test/java/io/reactivex/completable/CompletableTest.java

+17-11
Original file line numberDiff line numberDiff line change
@@ -2566,18 +2566,24 @@ public void run() { }
25662566

25672567
@Test(timeout = 5000)
25682568
public void subscribeTwoCallbacksCompleteThrows() {
2569-
final AtomicReference<Throwable> err = new AtomicReference<Throwable>();
2570-
normal.completable.subscribe(new Action() {
2571-
@Override
2572-
public void run() { throw new TestException(); }
2573-
}, new Consumer<Throwable>() {
2574-
@Override
2575-
public void accept(Throwable e) {
2576-
err.set(e);
2577-
}
2578-
});
2569+
List<Throwable> errors = TestHelper.trackPluginErrors();
2570+
try {
2571+
final AtomicReference<Throwable> err = new AtomicReference<Throwable>();
2572+
normal.completable.subscribe(new Action() {
2573+
@Override
2574+
public void run() { throw new TestException(); }
2575+
}, new Consumer<Throwable>() {
2576+
@Override
2577+
public void accept(Throwable e) {
2578+
err.set(e);
2579+
}
2580+
});
25792581

2580-
Assert.assertTrue(String.valueOf(err.get()), err.get() instanceof TestException);
2582+
Assert.assertNull(err.get());
2583+
TestHelper.assertUndeliverable(errors, 0, TestException.class);
2584+
} finally {
2585+
RxJavaPlugins.reset();
2586+
}
25812587
}
25822588

25832589
@Test(timeout = 5000)

src/test/java/io/reactivex/schedulers/TimedTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public void toStringOf() {
8484

8585
assertEquals("Timed[time=5, unit=SECONDS, value=1]", t1.toString());
8686
}
87-
87+
8888
@Test(expected = NullPointerException.class)
8989
public void timeUnitNullFail() throws Exception {
9090
new Timed<Integer>(1, 5, null);

0 commit comments

Comments
 (0)