From 3fce0e8e4576d85def88c3ccffdcb79a6846c93a Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Sun, 10 Nov 2013 22:19:45 +0000 Subject: [PATCH] xlattice findbugs --- .../xlattice/crypto/filters/BloomSHA1.java | 20 +++++++++---------- .../xlattice/crypto/filters/KeySelector.java | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/router/java/src/org/xlattice/crypto/filters/BloomSHA1.java b/router/java/src/org/xlattice/crypto/filters/BloomSHA1.java index 5b308ad746..52b7531ad8 100644 --- a/router/java/src/org/xlattice/crypto/filters/BloomSHA1.java +++ b/router/java/src/org/xlattice/crypto/filters/BloomSHA1.java @@ -45,16 +45,16 @@ import java.util.concurrent.LinkedBlockingQueue; */ public class BloomSHA1 { - protected final int m; - protected final int k; - protected int count; + private final int m; + private final int k; + private int count; - protected final int[] filter; - protected final KeySelector ks; + private final int[] filter; + private final KeySelector ks; // convenience variables - protected final int filterBits; - protected final int filterWords; + private final int filterBits; + private final int filterWords; private final BlockingQueue<int[]> buf; @@ -120,7 +120,7 @@ public class BloomSHA1 { this (20, 8); } /** Clear the filter, unsynchronized */ - protected void doClear() { + private void doClear() { Arrays.fill(filter, 0); count = 0; } @@ -186,9 +186,9 @@ public class BloomSHA1 { * @param b byte array representing a key (SHA1 digest) * @return true if b is in the filter */ - protected final boolean isMember(byte[] b) { return isMember(b, 0, b.length); } + private final boolean isMember(byte[] b) { return isMember(b, 0, b.length); } - protected final boolean isMember(byte[] b, int offset, int len) { + private final boolean isMember(byte[] b, int offset, int len) { int[] bitOffset = acquire(); int[] wordOffset = acquire(); ks.getOffsets(b, offset, len, bitOffset, wordOffset); diff --git a/router/java/src/org/xlattice/crypto/filters/KeySelector.java b/router/java/src/org/xlattice/crypto/filters/KeySelector.java index dc430ea2ff..878e40758c 100644 --- a/router/java/src/org/xlattice/crypto/filters/KeySelector.java +++ b/router/java/src/org/xlattice/crypto/filters/KeySelector.java @@ -40,14 +40,14 @@ public class KeySelector { } /** AND with byte to expose index-many bits */ - public final static int[] UNMASK = { + private final static int[] UNMASK = { // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767}; /** AND with byte to zero out index-many bits */ - public final static int[] MASK = { + private final static int[] MASK = { ~0,~1,~3,~7,~15,~31,~63,~127,~255,~511,~1023,~2047,~4095,~8191,~16383,~32767}; - public final static int TWO_UP_15 = 32 * 1024; + private final static int TWO_UP_15 = 32 * 1024; /** * Creates a key selector for a Bloom filter. When a key is presented -- GitLab