diff --git a/apps/BOB/src/net/i2p/BOB/BOB.java b/apps/BOB/src/net/i2p/BOB/BOB.java index e27bed7b1..8277fd259 100644 --- a/apps/BOB/src/net/i2p/BOB/BOB.java +++ b/apps/BOB/src/net/i2p/BOB/BOB.java @@ -221,15 +221,17 @@ public class BOB implements Runnable, ClientApp { if (!cfg.isAbsolute()) { cfg = new File(I2PAppContext.getGlobalContext().getConfigDir(), configLocation); } + FileInputStream fi = null; try { - FileInputStream fi = new FileInputStream(cfg); + fi = new FileInputStream(cfg); props.load(fi); - fi.close(); } catch (FileNotFoundException fnfe) { _log.warn("Unable to load up the BOB config file " + cfg.getAbsolutePath() + ", Using defaults.", fnfe); save = true; } catch (IOException ioe) { _log.warn("IOException on BOB config file " + cfg.getAbsolutePath() + ", using defaults.", ioe); + } finally { + if (fi != null) try { fi.close(); } catch (IOException ioe) {} } } // Global router and client API configurations that are missing are set to defaults here. @@ -276,13 +278,15 @@ public class BOB implements Runnable, ClientApp { if (!cfg.isAbsolute()) { cfg = new File(I2PAppContext.getGlobalContext().getConfigDir(), configLocation); } + FileOutputStream fo = null; try { _log.warn("Writing new defaults file " + cfg.getAbsolutePath()); - FileOutputStream fo = new FileOutputStream(cfg); + fo = new FileOutputStream(cfg); props.store(fo, cfg.getAbsolutePath()); - fo.close(); } catch (IOException ioe) { _log.error("IOException on BOB config file " + cfg.getAbsolutePath(), ioe); + } finally { + if (fo != null) try { fo.close(); } catch (IOException ioe) {} } } } diff --git a/apps/sam/java/src/net/i2p/sam/SAMv3Handler.java b/apps/sam/java/src/net/i2p/sam/SAMv3Handler.java index 9028e9c99..d73d6e33e 100644 --- a/apps/sam/java/src/net/i2p/sam/SAMv3Handler.java +++ b/apps/sam/java/src/net/i2p/sam/SAMv3Handler.java @@ -141,7 +141,7 @@ public class SAMv3Handler extends SAMv1Handler server.send(msg, addr); } - class Listener implements Runnable { + static class Listener implements Runnable { final DatagramChannel server; @@ -209,7 +209,7 @@ public class SAMv3Handler extends SAMv1Handler } } - public class SessionRecord + public static class SessionRecord { protected final String m_dest ; protected final Properties m_props ; @@ -262,10 +262,10 @@ public class SAMv3Handler extends SAMv1Handler { static final long serialVersionUID = 0x1 ; - class ExistingId extends Exception { + static class ExistingId extends Exception { static final long serialVersionUID = 0x1 ; } - class ExistingDest extends Exception { + static class ExistingDest extends Exception { static final long serialVersionUID = 0x1 ; } diff --git a/apps/sam/java/src/net/i2p/sam/SAMv3StreamSession.java b/apps/sam/java/src/net/i2p/sam/SAMv3StreamSession.java index c8c3361f8..485acb4fb 100644 --- a/apps/sam/java/src/net/i2p/sam/SAMv3StreamSession.java +++ b/apps/sam/java/src/net/i2p/sam/SAMv3StreamSession.java @@ -39,7 +39,7 @@ public class SAMv3StreamSession extends SAMStreamSession implements SAMv3Handle private final static Log _log = new Log ( SAMv3StreamSession.class ); - protected final int BUFFER_SIZE = 1024 ; + protected static final int BUFFER_SIZE = 1024 ; protected final Object socketServerLock = new Object(); protected I2PServerSocket socketServer = null; @@ -279,7 +279,8 @@ public class SAMv3StreamSession extends SAMStreamSession implements SAMv3Handle } } } - public class Pipe extends Thread + + public static class Pipe extends Thread { final ReadableByteChannel in ; final WritableByteChannel out ;