* findbugs: mostly stream closure fixes in router, apps, core

This commit is contained in:
dg2-new
2014-04-21 10:54:52 +00:00
parent b9491b269b
commit b84682fdc9
13 changed files with 46 additions and 23 deletions

View File

@@ -1415,6 +1415,8 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
//_log.error(getPrefix() + "Error generating keys to out", ioe);
//notifyEvent("genkeysResult", "error");
return;
} finally {
if(pubdest != null) try { pubdest.close(); } catch(IOException ioe) {}
}
} else if (args.length != 1) {
l.log("genkeys <privkeyfile> [<pubkeyfile>]\n" +

View File

@@ -94,7 +94,8 @@ public class IrcInboundFilter implements Runnable {
} catch (RuntimeException re) {
_log.error("Error filtering inbound data", re);
} finally {
try { local.close(); } catch (IOException e) {}
try { in.close(); } catch (IOException e) {}
try { local.close(); } catch(IOException e) {}
}
if(_log.shouldLog(Log.DEBUG))
_log.debug("IrcInboundFilter: Done.");

View File

@@ -468,8 +468,10 @@ public class SOCKS5Server extends SOCKSServer {
if (dest == null)
throw new SOCKSException("Outproxy not found");
I2PSocket destSock = tun.createI2PSocket(I2PAppContext.getGlobalContext().namingService().lookup(proxy), proxyOpts);
DataOutputStream out = null;
DataInputStream in = null;
try {
DataOutputStream out = new DataOutputStream(destSock.getOutputStream());
out = new DataOutputStream(destSock.getOutputStream());
boolean authAvail = Boolean.parseBoolean(props.getProperty(I2PTunnelHTTPClientBase.PROP_OUTPROXY_AUTH));
String configUser = null;
String configPW = null;
@@ -497,7 +499,7 @@ public class SOCKS5Server extends SOCKSServer {
out.flush();
// read init reply
DataInputStream in = new DataInputStream(destSock.getInputStream());
in = new DataInputStream(destSock.getInputStream());
// is this right or should we not try to do 5-to-4 conversion?
int hisVersion = in.readByte();
if (hisVersion != SOCKS_VERSION_5 /* && addrtype == AddressType.DOMAINNAME */ )
@@ -573,6 +575,8 @@ public class SOCKS5Server extends SOCKSServer {
throw new SOCKSException("Outproxy rejected request, response = " + reply);
// throw away the address in the response
// todo pass the response through?
out.close();
in.close();
} catch (IOException e) {
try { destSock.close(); } catch (IOException ioe) {}
throw e;