-
Notifications
You must be signed in to change notification settings - Fork 141
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
[SpotBugs] Set threshold to middle with exceptions #517
Conversation
Codecov Report
@@ Coverage Diff @@
## master #517 +/- ##
============================================
- Coverage 59.79% 59.76% -0.03%
+ Complexity 1770 1768 -2
============================================
Files 205 205
Lines 11531 11531
Branches 1033 1033
============================================
- Hits 6895 6892 -3
- Misses 4231 4233 +2
- Partials 405 406 +1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@@ -91,7 +92,7 @@ public synchronized ShuffleDataFlushEvent toFlushEvent( | |||
* So we should create a reference copy to avoid this. | |||
*/ | |||
inFlushedQueueBlocks = new LinkedList<>(spBlocks); | |||
spBlocks.sort((o1, o2) -> new Long(o1.getTaskAttemptId()).compareTo(o2.getTaskAttemptId())); |
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.
new Long()
is a bad practice, Long.valueOf()
should be used.
@@ -55,7 +55,7 @@ public PooledHdfsShuffleWriteHandler( | |||
// todo: support init lazily | |||
try { | |||
for (int i = 0; i < maxConcurrency; i++) { | |||
queue.offer( |
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.
Although it's expected to success here, we should always check the result of BlockingQueue#offer()
.
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.
this code seems a bit strange... Could we add some comment macro to disable this check?
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.
Yes, it is possible to add @SuppressFBWarnings
annotation.
But I think the original code looks strange, should we do some refactor?
@@ -55,7 +55,7 @@ public PooledHdfsShuffleWriteHandler( | |||
// todo: support init lazily | |||
try { | |||
for (int i = 0; i < maxConcurrency; i++) { | |||
queue.offer( |
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.
this code seems a bit strange... Could we add some comment macro to disable this check?
...age/src/main/java/org/apache/uniffle/storage/handler/impl/PooledHdfsShuffleWriteHandler.java
Outdated
Show resolved
Hide resolved
This reverts commit 4ff5bd8.
...age/src/main/java/org/apache/uniffle/storage/handler/impl/PooledHdfsShuffleWriteHandler.java
Show resolved
Hide resolved
Thanks @kaijchen, I'm merging this. |
Ref #532 |
What changes were proposed in this pull request?
Why are the changes needed?
Enforce stronger code quality check.
See violations fixed in this PR for example.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Run
mvn test-compile spotbugs:check
manually.