Findbugs all over

- volatile -> atomic
 - unused code and fields
 - closing streams
 - hashCode / equals
 - known non-null
 - Number.valueOf
 - new String
 Still avoiding SAM, BOB, SusiMail
This commit is contained in:
zzz
2013-11-16 13:22:05 +00:00
parent 96cf1d60c2
commit 1d4190734d
30 changed files with 107 additions and 64 deletions

View File

@@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 26;
public final static long BUILD = 27;
/** for example "-test" */
public final static String EXTRA = "";

View File

@@ -285,7 +285,7 @@ public class TunnelPoolSettings {
private static final boolean getBoolean(String str, boolean defaultValue) {
if (str == null) return defaultValue;
boolean v = Boolean.parseBoolean(str) ||
(str != null && "YES".equals(str.toUpperCase(Locale.US)));
"YES".equals(str.toUpperCase(Locale.US));
return v;
}

View File

@@ -681,10 +681,17 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
*
* this is safe to call multiple times (only tells the client once)
*/
/****
private void dieFatal() {
dieFatal(MessageStatusMessage.STATUS_SEND_GUARANTEED_FAILURE);
}
****/
/**
* give up the ghost, this message just aint going through. tell the client.
*
* this is safe to call multiple times (only tells the client once)
*/
private void dieFatal(int status) {
if (_finished.getAndSet(true))
return;

View File

@@ -97,10 +97,6 @@ class FloodfillVerifyStoreJob extends JobImpl {
return;
}
DatabaseLookupMessage lookup = buildLookup(replyTunnelInfo);
if (lookup == null) {
_facade.verifyFinished(_key);
return;
}
// If we are verifying a leaseset, use the destination's own tunnels,
// to avoid association by the exploratory tunnel OBEP.
@@ -180,6 +176,7 @@ class FloodfillVerifyStoreJob extends JobImpl {
return _sentTo;
}
/** @return non-null */
private DatabaseLookupMessage buildLookup(TunnelInfo replyTunnelInfo) {
// If we are verifying a leaseset, use the destination's own tunnels,
// to avoid association by the exploratory tunnel OBEP.

View File

@@ -8,6 +8,8 @@ package net.i2p.router.tasks;
*
*/
import java.util.concurrent.atomic.AtomicInteger;
import net.i2p.router.Router;
import net.i2p.router.RouterContext;
import net.i2p.router.RouterVersion;
@@ -21,12 +23,12 @@ import net.i2p.util.Log;
*/
public class ShutdownHook extends Thread {
private final RouterContext _context;
private static int __id = 0;
private static final AtomicInteger __id = new AtomicInteger();
private final int _id;
public ShutdownHook(RouterContext ctx) {
_context = ctx;
_id = ++__id;
_id = __id.incrementAndGet();
}
@Override

View File

@@ -292,6 +292,12 @@ class GeoIPv6 {
return 0;
}
@Override
public int hashCode() { return (((int) from) ^ ((int) to)); }
@Override
public boolean equals(Object o) { return (o instanceof V6Entry) && compareTo((V6Entry)o) == 0; }
@Override
public String toString() {
return "0x" + Long.toHexString(from) + " -> 0x" + Long.toHexString(to) + " : " + cc;