misc. findbugs fixes

This commit is contained in:
zzz
2011-07-08 17:40:43 +00:00
parent f173e88787
commit 9d4cc26890
4 changed files with 15 additions and 11 deletions

View File

@ -783,7 +783,7 @@ public class SnarkManager implements Snark.CompleteListener {
throw ioe; throw ioe;
} finally { } finally {
try { try {
if (out == null) if (out != null)
out.close(); out.close();
} catch (IOException ioe) {} } catch (IOException ioe) {}
} }

View File

@ -1189,7 +1189,9 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
String filename = null; String filename = null;
try { try {
filename = targetRequest.substring(LOCAL_SERVER.length() + 8, space); // "/themes/".length filename = targetRequest.substring(LOCAL_SERVER.length() + 8, space); // "/themes/".length
} catch (IndexOutOfBoundsException ioobe) {} } catch (IndexOutOfBoundsException ioobe) {
return;
}
// theme hack // theme hack
if (filename.startsWith("console/default/")) if (filename.startsWith("console/default/"))
filename = filename.replaceFirst("default", I2PAppContext.getGlobalContext().getProperty("routerconsole.theme", "light")); filename = filename.replaceFirst("default", I2PAppContext.getGlobalContext().getProperty("routerconsole.theme", "light"));

View File

@ -125,9 +125,9 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase implements Runnable
*/ */
public static class IrcInboundFilter implements Runnable { public static class IrcInboundFilter implements Runnable {
private Socket local; private final Socket local;
private I2PSocket remote; private final I2PSocket remote;
private StringBuffer expectedPong; private final StringBuffer expectedPong;
private final Log _log; private final Log _log;
public IrcInboundFilter(Socket _local, I2PSocket _remote, StringBuffer pong, Log log) { public IrcInboundFilter(Socket _local, I2PSocket _remote, StringBuffer pong, Log log) {
@ -191,7 +191,7 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase implements Runnable
} catch (RuntimeException re) { } catch (RuntimeException re) {
_log.error("Error filtering inbound data", re); _log.error("Error filtering inbound data", re);
} finally { } finally {
if (local != null) try { local.close(); } catch (IOException e) {} try { local.close(); } catch (IOException e) {}
} }
if(_log.shouldLog(Log.DEBUG)) if(_log.shouldLog(Log.DEBUG))
_log.debug("IrcInboundFilter: Done."); _log.debug("IrcInboundFilter: Done.");
@ -204,9 +204,9 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase implements Runnable
*/ */
public static class IrcOutboundFilter implements Runnable { public static class IrcOutboundFilter implements Runnable {
private Socket local; private final Socket local;
private I2PSocket remote; private final I2PSocket remote;
private StringBuffer expectedPong; private final StringBuffer expectedPong;
private final Log _log; private final Log _log;
public IrcOutboundFilter(Socket _local, I2PSocket _remote, StringBuffer pong, Log log) { public IrcOutboundFilter(Socket _local, I2PSocket _remote, StringBuffer pong, Log log) {
@ -270,7 +270,7 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase implements Runnable
} catch (RuntimeException re) { } catch (RuntimeException re) {
_log.error("Error filtering outbound data", re); _log.error("Error filtering outbound data", re);
} finally { } finally {
if (remote != null) try { remote.close(); } catch (IOException e) {} try { remote.close(); } catch (IOException e) {}
} }
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug("IrcOutboundFilter: Done."); _log.debug("IrcOutboundFilter: Done.");

View File

@ -25,6 +25,8 @@ public abstract class FormatDate
public static String format(long date) public static String format(long date)
{ {
return _dateFormat.format(new Date(date)); synchronized(_dateFormat) {
return _dateFormat.format(new Date(date));
}
} }
} }