findbugs sam/bob

This commit is contained in:
zzz
2014-03-12 12:27:23 +00:00
parent 51911bd9a8
commit 96b4c6b219
3 changed files with 15 additions and 10 deletions

View File

@@ -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) {}
}
}
}

View File

@@ -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 ;
}

View File

@@ -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 ;