From f14def37c4baeb0daa227466290895097da5f9ad Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Tue, 14 Jan 2020 21:20:46 -0800 Subject: [PATCH] Fix and/or filter some SpotBugs --- .../org/apache/datasketches/hll/TgtHllType.java | 2 +- .../apache/datasketches/hll/IsomorphicTest.java | 7 ++----- .../org/apache/datasketches/hll/UnionCaseTest.java | 7 ++++--- tools/FindBugsExcludeFilter.xml | 14 ++++++++++++++ 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/apache/datasketches/hll/TgtHllType.java b/src/main/java/org/apache/datasketches/hll/TgtHllType.java index 49fc8a882..4c0a8a45c 100644 --- a/src/main/java/org/apache/datasketches/hll/TgtHllType.java +++ b/src/main/java/org/apache/datasketches/hll/TgtHllType.java @@ -54,7 +54,7 @@ @SuppressWarnings("javadoc") public enum TgtHllType { HLL_4, HLL_6, HLL_8; - public static final TgtHllType values[] = values(); + private static final TgtHllType values[] = values(); public static final TgtHllType fromOrdinal(final int typeId) { return values[typeId]; diff --git a/src/test/java/org/apache/datasketches/hll/IsomorphicTest.java b/src/test/java/org/apache/datasketches/hll/IsomorphicTest.java index 3c229276c..d896b7db5 100644 --- a/src/test/java/org/apache/datasketches/hll/IsomorphicTest.java +++ b/src/test/java/org/apache/datasketches/hll/IsomorphicTest.java @@ -36,9 +36,6 @@ @SuppressWarnings({"javadoc", "unused"}) public class IsomorphicTest { long v = 0; - final int maxLgK = 12; - HllSketch source; - Union union; @Test //Merges a type1 to an empty union (heap, HLL_8), and gets result as type1, checks binary equivalence @@ -227,7 +224,7 @@ public void isomorphicHllMerges2() { bytesOut6 = u.getResult(HLL_8).toUpdatableByteArray();//should be identical except for HllAccum comb = "LgK: " + lgK + ", SkType: HLL_6, Compared with SkType HLL_8"; - checkArrays(bytesOut8, bytesOut6, comb, true); + checkArrays(bytesOut8, bytesOut6, comb, false); u = buildHeapUnionHllMode(lgK, 0); sk = buildHeapSketchHllMode(lgK, HLL_4, 1 << lgK); @@ -235,7 +232,7 @@ public void isomorphicHllMerges2() { bytesOut4 = u.getResult(HLL_8).toUpdatableByteArray();//should be identical except for HllAccum comb = "LgK: " + lgK + ", SkType: HLL_4, Compared with SkType HLL_8"; - checkArrays(bytesOut8, bytesOut4, comb, true); + checkArrays(bytesOut8, bytesOut4, comb, false); } } diff --git a/src/test/java/org/apache/datasketches/hll/UnionCaseTest.java b/src/test/java/org/apache/datasketches/hll/UnionCaseTest.java index 03c6d4e39..c6bf77cc4 100644 --- a/src/test/java/org/apache/datasketches/hll/UnionCaseTest.java +++ b/src/test/java/org/apache/datasketches/hll/UnionCaseTest.java @@ -40,11 +40,12 @@ */ @SuppressWarnings("javadoc") public class UnionCaseTest { + private static final String LS = System.getProperty("line.separator"); long v = 0; - final int maxLgK = 12; + final static int maxLgK = 12; HllSketch source; - Union union; - String hfmt = "%10s%10s%10s%10s%10s%10s%10s%10s%10s%10s%10s\n"; + //Union union; + String hfmt = "%10s%10s%10s%10s%10s%10s%10s%10s%10s%10s%10s" + LS; String hdr = String.format(hfmt, "caseNum","srcLgKStr","gdtLgKStr","srcType","gdtType", "srcMem","gdtMem","srcMode","gdtMode","srcOoof","gdtOoof"); diff --git a/tools/FindBugsExcludeFilter.xml b/tools/FindBugsExcludeFilter.xml index 256040ed1..e5fd93e09 100644 --- a/tools/FindBugsExcludeFilter.xml +++ b/tools/FindBugsExcludeFilter.xml @@ -44,6 +44,20 @@ under the License. + + + + + + + + + + + + + +