findbugs correctness fixes, all over the place

This commit is contained in:
zzz
2013-11-07 19:20:25 +00:00
parent 5cbecb3599
commit ae76a6ee1a
8 changed files with 21 additions and 15 deletions

View File

@@ -2487,7 +2487,6 @@ public class I2PSnarkServlet extends BasicServlet {
Storage storage = snark.getStorage();
try {
File f = item;
if (f != null) {
long remaining = storage.remaining(f.getCanonicalPath());
if (remaining < 0) {
complete = true;
@@ -2507,9 +2506,6 @@ public class I2PSnarkServlet extends BasicServlet {
(100 * (length - remaining) / length) + "% " + _("complete") +
" (" + DataHelper.formatSize2(remaining) + "B " + _("remaining") + ")";
}
} else {
status = "Not a file?";
}
} catch (IOException ioe) {
status = "Not a file? " + ioe;
}

View File

@@ -318,8 +318,7 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
if (s.isClosed()) {
if (_log.shouldLog(Log.INFO))
_log.info(tunnel.getClientOptions().getProperty("inbound.nickname") + ": Building a new socket manager since the old one closed [s=" + s + "]");
if (s != null)
tunnel.removeSession(s);
tunnel.removeSession(s);
// We could be here a LONG time, holding the lock
socketManager = buildSocketManager(tunnel, pkf);
} else {

View File

@@ -128,7 +128,7 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
int pp = getIntOption(OPT_POST_MAX, 0);
int pt = getIntOption(OPT_POST_TOTAL_MAX, 0);
synchronized(this) {
if (pp != 0 || pp != 0 || _postThrottler != null) {
if (pp != 0 || pt != 0 || _postThrottler != null) {
long pw = 1000L * getIntOption(OPT_POST_WINDOW, DEFAULT_POST_WINDOW);
long pb = 1000L * getIntOption(OPT_POST_BAN_TIME, DEFAULT_POST_BAN_TIME);
long px = 1000L * getIntOption(OPT_POST_TOTAL_BAN_TIME, DEFAULT_POST_TOTAL_BAN_TIME);

View File

@@ -3,6 +3,7 @@ package net.i2p.router.web;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Collections;
import java.util.List;
import java.util.HashSet;
import java.util.Set;
@@ -309,6 +310,8 @@ public class StatSummarizer implements Runnable {
* @return list of Rate objects
*/
Set<Rate> parseSpecs(String specs) {
if (specs == null)
return Collections.EMPTY_SET;
StringTokenizer tok = new StringTokenizer(specs, ",");
Set<Rate> rv = new HashSet();
while (tok.hasMoreTokens()) {

View File

@@ -202,7 +202,7 @@ class ConnectionPacketHandler {
if (_log.shouldLog(Log.WARN))
_log.warn(String.format("%s congestion.. dup packet %s ackDelay %d lastSend %d ago",
con, packet, now, ackDelay, DataHelper.formatDuration(now - lastSendTime)));
con, packet, ackDelay, DataHelper.formatDuration(now - lastSendTime)));
final long nextSendTime = lastSendTime + ackDelay;
if (nextSendTime <= now) {