Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.x: explain null observer/subscriber error reports in detail from RxJavaPlugins #6175

Conversation

punitda
Copy link
Contributor

@punitda punitda commented Aug 26, 2018

This PR is related to issue #6172.
With these changes, all reactive types will emit detailed error message when onSubscribe hook installed using RxJavaPlugins returns null observer/subscriber:

Observable

"The RxJavaPlugins.onSubscribe hook returned a null Observer. Please check the handler provided to RxJavaPlugins.setOnObservableSubscribe for invalid null returns. Further reading: https://github.com/ReactiveX/RxJava/wiki/Plugins"

Flowable

The RxJavaPlugins.onSubscribe hook returned a null FlowableSubscriber. Please check the handler provided to RxJavaPlugins.setOnFlowableSubscribe for invalid null returns. Further reading: https://github.com/ReactiveX/RxJava/wiki/Plugins

Single

The RxJavaPlugins.onSubscribe hook returned a null SingleObserver. Please check the handler provided to RxJavaPlugins.setOnSingleSubscribe for invalid null returns. Further reading: https://github.com/ReactiveX/RxJava/wiki/Plugins

Maybe

The RxJavaPlugins.onSubscribe hook returned a null MaybeObserver. Please check the handler provided to RxJavaPlugins.setOnMaybeSubscribe for invalid null returns. Further reading: https://github.com/ReactiveX/RxJava/wiki/Plugins

Completable

The RxJavaPlugins.onSubscribe hook returned a null CompletableObserver. Please check the handler provided to RxJavaPlugins.setOnCompletableSubscribe for invalid null returns. Further reading: https://github.com/ReactiveX/RxJava/wiki/Plugins

Note :
There was no null check on observer returned from RxJavaPlugins.onSubscribe(this, observer) method call in Completable's subscribe() method.
So, I've added it in this PR. Is that fine?

@@ -2168,6 +2168,8 @@ public final void subscribe(CompletableObserver observer) {

observer = RxJavaPlugins.onSubscribe(this, observer);

ObjectHelper.requireNonNull(observer, "The RxJavaPlugins.onSubscribe hook returned a null CompletableObserver. Please check the handler provided to RxJavaPlugins.setOnCompletableSubscribe for invalid null returns. Further reading: https://github.com/ReactiveX/RxJava/wiki/Plugins");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@codecov
Copy link

codecov bot commented Aug 26, 2018

Codecov Report

Merging #6175 into 2.x will decrease coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##                2.x    #6175      +/-   ##
============================================
- Coverage     98.23%   98.22%   -0.02%     
- Complexity     6196     6199       +3     
============================================
  Files           667      667              
  Lines         44879    44880       +1     
  Branches       6214     6214              
============================================
- Hits          44089    44085       -4     
+ Misses          253      252       -1     
- Partials        537      543       +6
Impacted Files Coverage Δ Complexity Δ
src/main/java/io/reactivex/Flowable.java 100% <100%> (ø) 566 <0> (ø) ⬇️
src/main/java/io/reactivex/Maybe.java 100% <100%> (ø) 171 <0> (ø) ⬇️
src/main/java/io/reactivex/Completable.java 100% <100%> (ø) 117 <0> (ø) ⬇️
src/main/java/io/reactivex/Observable.java 100% <100%> (ø) 541 <0> (ø) ⬇️
src/main/java/io/reactivex/Single.java 100% <100%> (ø) 146 <0> (ø) ⬇️
.../operators/flowable/FlowableBlockingSubscribe.java 93.02% <0%> (-4.66%) 10% <0%> (-1%)
...ternal/operators/observable/ObservablePublish.java 96.46% <0%> (-3.54%) 11% <0%> (ø)
.../io/reactivex/internal/schedulers/IoScheduler.java 89.24% <0%> (-2.16%) 9% <0%> (ø)
...nternal/operators/observable/ObservableCreate.java 97.43% <0%> (-1.71%) 2% <0%> (ø)
...x/internal/operators/flowable/FlowablePublish.java 97.87% <0%> (-1.71%) 11% <0%> (ø)
... and 25 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba7bbb4...894bb48. Read the comment docs.

@akarnokd akarnokd merged commit e2a2159 into ReactiveX:2.x Aug 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants