ACCUMULO-2715 Fix findbugs integer comparison warning in examples
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/d392b120 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/d392b120 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/d392b120 Branch: refs/heads/master Commit: d392b120025d40eb4a79a5309cf35af1df49db1c Parents: 7790c08 Author: Christopher Tubbs <ctubb...@apache.org> Authored: Tue Apr 22 12:40:12 2014 -0400 Committer: Christopher Tubbs <ctubb...@apache.org> Committed: Wed Apr 23 11:39:13 2014 -0400 ---------------------------------------------------------------------- .../examples/simple/client/RandomBatchWriter.java | 10 ++++------ pom.xml | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/d392b120/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchWriter.java ---------------------------------------------------------------------- diff --git a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchWriter.java b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchWriter.java index 44947d1..ef3d691 100644 --- a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchWriter.java +++ b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchWriter.java @@ -124,12 +124,10 @@ public class RandomBatchWriter { Opts opts = new Opts(); BatchWriterOpts bwOpts = new BatchWriterOpts(); opts.parseArgs(RandomBatchWriter.class.getName(), args, bwOpts); - if ((opts.max - opts.min) < (long)opts.num) { - System.err - .println(String - .format( - "You must specify a min and a max that allow for at least num possible values. For example, you requested %d rows, but a min of %d and a max of %d (exclusive), which only allows for %d rows.", - opts.num, opts.min, opts.max, (opts.max - opts.min))); + if ((opts.max - opts.min) < 1L * opts.num) { // right-side multiplied by 1L to convert to long in a way that doesn't trigger FindBugs + System.err.println(String.format("You must specify a min and a max that allow for at least num possible values. " + + "For example, you requested %d rows, but a min of %d and a max of %d (exclusive), which only allows for %d rows.", opts.num, opts.min, opts.max, + (opts.max - opts.min))); System.exit(1); } Random r; http://git-wip-us.apache.org/repos/asf/accumulo/blob/d392b120/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 2edb662..f709775 100644 --- a/pom.xml +++ b/pom.xml @@ -460,7 +460,7 @@ <effort>Max</effort> <failOnError>true</failOnError> <includeTests>true</includeTests> - <maxRank>1</maxRank> + <maxRank>3</maxRank> </configuration> </plugin> <plugin>