diff --git a/core/java/src/net/i2p/util/FileUtil.java b/core/java/src/net/i2p/util/FileUtil.java index 68ce4e4f6..de9d354aa 100644 --- a/core/java/src/net/i2p/util/FileUtil.java +++ b/core/java/src/net/i2p/util/FileUtil.java @@ -357,6 +357,9 @@ public class FileUtil { * Dump the contents of the given path (relative to the root) to the output * stream. The path must not go above the root, either - if it does, it will * throw a FileNotFoundException + * + * Closes the OutputStream out on successful completion + * but leaves it open when throwing IOE. */ public static void readFile(String path, String root, OutputStream out) throws IOException { File rootDir = new File(root); @@ -376,10 +379,10 @@ public class FileUtil { int read = 0; while ( (read = in.read(buf)) != -1) out.write(buf, 0, read); - out.close(); + try { out.close(); } catch (IOException ioe) {} } finally { if (in != null) - in.close(); + try { in.close(); } catch (IOException ioe) {} } } diff --git a/router/java/src/net/i2p/router/peermanager/TunnelHistory.java b/router/java/src/net/i2p/router/peermanager/TunnelHistory.java index bc6109bca..6ad8c3d00 100644 --- a/router/java/src/net/i2p/router/peermanager/TunnelHistory.java +++ b/router/java/src/net/i2p/router/peermanager/TunnelHistory.java @@ -111,6 +111,7 @@ public class TunnelHistory { _lastFailed = _context.clock().now(); } +/***** all unused public void setLifetimeAgreedTo(long num) { _lifetimeAgreedTo = num; } public void setLifetimeRejected(long num) { _lifetimeRejected = num; } public void setLifetimeFailed(long num) { _lifetimeFailed = num; } @@ -120,6 +121,7 @@ public class TunnelHistory { public void setLastRejectedTransient(long when) { _lastRejectedTransient = when; } public void setLastRejectedProbabalistic(long when) { _lastRejectedProbabalistic = when; } public void setLastFailed(long when) { _lastFailed = when; } +******/ public RateStat getRejectionRate() { return _rejectRate; } public RateStat getFailedRate() { return _failRate; } diff --git a/router/java/src/net/i2p/router/tunnel/TunnelCreatorConfig.java b/router/java/src/net/i2p/router/tunnel/TunnelCreatorConfig.java index 99b612dd2..497e8ddcd 100644 --- a/router/java/src/net/i2p/router/tunnel/TunnelCreatorConfig.java +++ b/router/java/src/net/i2p/router/tunnel/TunnelCreatorConfig.java @@ -18,17 +18,17 @@ import net.i2p.router.TunnelInfo; * */ public class TunnelCreatorConfig implements TunnelInfo { - protected RouterContext _context; + protected final RouterContext _context; /** only necessary for client tunnels */ - private Hash _destination; + private final Hash _destination; /** gateway first */ - private HopConfig _config[]; + private final HopConfig _config[]; /** gateway first */ - private Hash _peers[]; + private final Hash _peers[]; private long _expiration; private List _order; private long _replyMessageId; - private boolean _isInbound; + private final boolean _isInbound; private long _messagesProcessed; private volatile long _verifiedBytesTransferred; private boolean _failed; @@ -48,10 +48,6 @@ public class TunnelCreatorConfig implements TunnelInfo { } _isInbound = isInbound; _destination = destination; - _messagesProcessed = 0; - _verifiedBytesTransferred = 0; - _failed = false; - _failures = 0; } /** diff --git a/router/java/src/net/i2p/router/tunnel/pool/PooledTunnelCreatorConfig.java b/router/java/src/net/i2p/router/tunnel/pool/PooledTunnelCreatorConfig.java index cbe794815..d66bf6f6c 100644 --- a/router/java/src/net/i2p/router/tunnel/pool/PooledTunnelCreatorConfig.java +++ b/router/java/src/net/i2p/router/tunnel/pool/PooledTunnelCreatorConfig.java @@ -26,8 +26,6 @@ class PooledTunnelCreatorConfig extends TunnelCreatorConfig { } public PooledTunnelCreatorConfig(RouterContext ctx, int length, boolean isInbound, Hash destination) { super(ctx, length, isInbound, destination); - _pool = null; - _live = false; } // calls TestJob