-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Conversation
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 Report
@@ 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
Continue to review full report at Codecov.
|
There was a problem hiding this 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) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, already merged.
There was a problem hiding this comment.
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.
* 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
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 asif (root == null || cause == root)
.As a side note, I think this method should be made
static
(that would have prevented the bug).