You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2021/12/13 19:45:48 UTC

[GitHub] [hbase] apurtell commented on a change in pull request #3936: HBASE-26555 Fix findbugs/spotbugs findings

apurtell commented on a change in pull request #3936:
URL: https://github.com/apache/hbase/pull/3936#discussion_r768068944



##########
File path: hbase-it/src/test/java/org/apache/hadoop/hbase/mapreduce/IntegrationTestBulkLoad.java
##########
@@ -373,7 +375,11 @@ public void close() throws IOException {
       taskId = taskId + iteration * numMapTasks;
       numMapTasks = numMapTasks * numIterations;
 
-      long chainId = Math.abs(new Random().nextLong());
+      // ensure chainId is positive
+      long chainId = RNG.nextLong();
+      if (chainId < 0) {

Review comment:
       As explained by the help text for the spotbugs finding the issue is Math.abs(INT_MIN) can return INT_MIN. So if ABS is supposed to ensure a positive number, it will not always do so. The fix is to change the sign of the value if it is negative and should not be negative. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org