forked from I2P_Developers/i2p.i2p
findbugs correctness fixes, all over the place
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
@ -318,7 +318,6 @@ 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);
|
||||
// We could be here a LONG time, holding the lock
|
||||
socketManager = buildSocketManager(tunnel, pkf);
|
||||
|
@ -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);
|
||||
|
@ -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()) {
|
||||
|
@ -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) {
|
||||
|
@ -197,6 +197,9 @@ public class TunnelPoolSettings {
|
||||
|
||||
public Properties getUnknownOptions() { return _unknownOptions; }
|
||||
|
||||
/**
|
||||
* @param prefix non-null
|
||||
*/
|
||||
public void readFromProperties(String prefix, Map<Object, Object> props) {
|
||||
for (Map.Entry e : props.entrySet()) {
|
||||
String name = (String) e.getKey();
|
||||
@ -225,11 +228,14 @@ public class TunnelPoolSettings {
|
||||
int max = _isExploratory ? EXPLORATORY_PRIORITY : MAX_PRIORITY;
|
||||
_priority = Math.min(max, Math.max(MIN_PRIORITY, getInt(value, def)));
|
||||
} else
|
||||
_unknownOptions.setProperty(name.substring((prefix != null ? prefix.length() : 0)), value);
|
||||
_unknownOptions.setProperty(name.substring(prefix.length()), value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param prefix non-null
|
||||
*/
|
||||
public void writeToProperties(String prefix, Properties props) {
|
||||
if (props == null) return;
|
||||
props.setProperty(prefix + PROP_ALLOW_ZERO_HOP, ""+_allowZeroHop);
|
||||
|
@ -320,10 +320,12 @@ class BuildExecutor implements Runnable {
|
||||
// we don't have either inbound or outbound tunnels, so don't bother trying to build
|
||||
// non-zero-hop tunnels
|
||||
// try to kickstart it to build a fallback, otherwise we may get stuck here for a long time (minutes)
|
||||
if (mgr != null) {
|
||||
if (mgr.getFreeTunnelCount() <= 0)
|
||||
mgr.selectInboundTunnel();
|
||||
if (mgr.getOutboundTunnelCount() <= 0)
|
||||
mgr.selectOutboundTunnel();
|
||||
}
|
||||
synchronized (_currentlyBuilding) {
|
||||
if (!_repoll) {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
|
@ -261,7 +261,7 @@ public class TunnelPool {
|
||||
}
|
||||
}
|
||||
if (rv != null) {
|
||||
_context.statManager().addRateData("tunnel.matchLease", closestTo.equals(rv) ? 1 : 0);
|
||||
_context.statManager().addRateData("tunnel.matchLease", closestTo.equals(rv.getFarEnd()) ? 1 : 0);
|
||||
} else {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn(toString() + ": No tunnels to select from");
|
||||
|
Reference in New Issue
Block a user