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

Fix bug in CompositeException.getRootCause #6380

Merged
merged 2 commits into from
Jan 21, 2019

Conversation

guillermocalvo
Copy link
Contributor

I found what I believe is a bug in CompositeException.getRootCause.

The original code use to be if (root == null || root == e), but apparently after some refactoring it ended up as if (root == null || cause == root).

As a side note, I think this method should be made static (that would have prevented the bug).

The original code use to be `if (root == null || root == e)`, but apparently after some refactoring it ended up as `if (root == null || cause == root)`, which I believe is a bug.

This method should probably be `static` (that would have prevented the bug).
@codecov
Copy link

codecov bot commented Jan 21, 2019

Codecov Report

Merging #6380 into 2.x will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##                2.x    #6380      +/-   ##
============================================
+ Coverage     98.25%   98.28%   +0.02%     
+ Complexity     6292     6290       -2     
============================================
  Files           673      673              
  Lines         45092    45092              
  Branches       6239     6239              
============================================
+ Hits          44306    44317      +11     
+ Misses          248      241       -7     
+ Partials        538      534       -4
Impacted Files Coverage Δ Complexity Δ
...va/io/reactivex/exceptions/CompositeException.java 100% <100%> (ø) 36 <0> (ø) ⬇️
...nternal/operators/parallel/ParallelReduceFull.java 91.08% <0%> (-3.97%) 2% <0%> (ø)
...ternal/operators/observable/ObservablePublish.java 94.69% <0%> (-3.54%) 11% <0%> (ø)
...reactivex/internal/operators/single/SingleAmb.java 96.61% <0%> (-3.39%) 9% <0%> (-1%)
...l/operators/observable/ObservableFlatMapMaybe.java 93.46% <0%> (-2.62%) 2% <0%> (ø)
...perators/observable/ObservableMergeWithSingle.java 99.06% <0%> (-0.94%) 2% <0%> (ø)
.../operators/mixed/FlowableConcatMapCompletable.java 99.14% <0%> (-0.86%) 2% <0%> (ø)
...ernal/operators/flowable/FlowableTimeoutTimed.java 98.37% <0%> (-0.82%) 3% <0%> (ø)
...a/io/reactivex/internal/util/QueueDrainHelper.java 99.3% <0%> (-0.7%) 57% <0%> (-1%)
...ternal/operators/observable/ObservableTimeout.java 99.36% <0%> (-0.64%) 3% <0%> (ø)
... and 22 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 d40f923...a7d97cb. Read the comment docs.

Copy link
Contributor

@artem-zinnatullin artem-zinnatullin left a comment

Choose a reason for hiding this comment

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

Good catch 👍

@@ -280,7 +280,7 @@ public int size() {
*/
/*private */Throwable getRootCause(Throwable e) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you should go ahead and make it static

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, already merged.

Copy link
Member

Choose a reason for hiding this comment

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

Just post a new PR.

@akarnokd akarnokd added this to the 2.2 backlog milestone Jan 21, 2019
@akarnokd akarnokd merged commit 621b8cd into ReactiveX:2.x Jan 21, 2019
@guillermocalvo guillermocalvo deleted the patch-1 branch January 21, 2019 09:38
guillermocalvo added a commit to guillermocalvo/RxJava that referenced this pull request Jan 21, 2019
* Fix bug in CompositeException.getRootCause 

The original code use to be `if (root == null || root == e)`, but apparently after some refactoring it ended up as `if (root == null || cause == root)`, which I believe is a bug.

This method should probably be `static` (that would have prevented the bug).

* Update unit tests for CompositeException.getRootCause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants