accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] ctubbsii commented on a change in pull request #991: Fix code quality alerts found by lgtm
Date Wed, 27 Feb 2019 20:56:15 GMT
ctubbsii commented on a change in pull request #991: Fix code quality alerts found by lgtm
URL: https://github.com/apache/accumulo/pull/991#discussion_r260939134
 
 

 ##########
 File path: core/src/main/java/org/apache/accumulo/core/client/summary/SummarizerConfiguration.java
 ##########
 @@ -253,7 +253,7 @@ public Builder addOptions(String... keyValuePairs) {
       Preconditions.checkArgument(keyValuePairs.length % 2 == 0 && keyValuePairs.length
> 0,
           "Require an even, positive number of arguments, got %s", keyValuePairs.length);
       for (int i = 0; i < keyValuePairs.length; i += 2) {
-        addOption(keyValuePairs[i], keyValuePairs[i + 1]);
+        addOption(keyValuePairs[i], keyValuePairs[i + 1]); // lgtm [java/index-out-of-bounds]
 
 Review comment:
   Could instead add a bounds check here to ensure there's at least 2. An explicit check and
throw is better than relying on the incidental error. I think Preconditions might have a convenience
method for bounds checking, that throws a reasonable RTE type, with a better message.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message