findbugs BOB/SAM. more to do.

This commit is contained in:
dg2-new
2013-11-20 12:02:44 +00:00
parent 413ad6b0e6
commit 28b6675979
6 changed files with 31 additions and 29 deletions

View File

@@ -817,10 +817,10 @@ public class DoCMDS implements Runnable {
try {
database.add(Arg, nickinfo);
nickinfo.add(P_NICKNAME, Arg);
nickinfo.add(P_STARTING, new Boolean(false));
nickinfo.add(P_RUNNING, new Boolean(false));
nickinfo.add(P_STOPPING, new Boolean(false));
nickinfo.add(P_QUIET, new Boolean(false));
nickinfo.add(P_STARTING, Boolean.valueOf(false));
nickinfo.add(P_RUNNING, Boolean.valueOf(false));
nickinfo.add(P_STOPPING, Boolean.valueOf(false));
nickinfo.add(P_QUIET, Boolean.valueOf(false));
nickinfo.add(P_INHOST, "localhost");
nickinfo.add(P_OUTHOST, "localhost");
Properties Q = new Properties();
@@ -1076,7 +1076,7 @@ public class DoCMDS implements Runnable {
prt = Integer.parseInt(Arg);
if (prt > 1 && prt < 65536) {
try {
nickinfo.add(P_OUTPORT, new Integer(prt));
nickinfo.add(P_OUTPORT, Integer.valueOf(prt));
} catch (Exception ex) {
try {
wunlock();
@@ -1355,7 +1355,7 @@ public class DoCMDS implements Runnable {
break die;
}
nickinfo.add(P_STOPPING, new Boolean(true));
nickinfo.add(P_STOPPING, Boolean.valueOf(true));
try {
wunlock();

View File

@@ -104,7 +104,7 @@ public class MUXlisten implements Runnable {
// Something went bad.
this.database.getWriteLock();
this.info.getWriteLock();
this.info.add("STARTING", new Boolean(false));
this.info.add("STARTING", Boolean.valueOf(false));
this.info.releaseWriteLock();
this.database.releaseWriteLock();
throw new IOException(e.toString());
@@ -112,7 +112,7 @@ public class MUXlisten implements Runnable {
// Something went bad.
this.database.getWriteLock();
this.info.getWriteLock();
this.info.add("STARTING", new Boolean(false));
this.info.add("STARTING", Boolean.valueOf(false));
this.info.releaseWriteLock();
this.database.releaseWriteLock();
throw new RuntimeException(e);
@@ -120,7 +120,7 @@ public class MUXlisten implements Runnable {
// Something else went bad.
this.database.getWriteLock();
this.info.getWriteLock();
this.info.add("STARTING", new Boolean(false));
this.info.add("STARTING", Boolean.valueOf(false));
this.info.releaseWriteLock();
this.database.releaseWriteLock();
e.printStackTrace();
@@ -204,7 +204,7 @@ public class MUXlisten implements Runnable {
try {
wlock();
try {
info.add("STARTING", new Boolean(false));
info.add("STARTING", Boolean.valueOf(false));
} catch (Exception e) {
wunlock();
break quit;
@@ -258,9 +258,9 @@ public class MUXlisten implements Runnable {
try {
wlock();
try {
info.add("STARTING", new Boolean(false));
info.add("STOPPING", new Boolean(true));
info.add("RUNNING", new Boolean(false));
info.add("STARTING", Boolean.valueOf(false));
info.add("STOPPING", Boolean.valueOf(true));
info.add("RUNNING", Boolean.valueOf(false));
} catch (Exception e) {
lock.set(false);
wunlock();
@@ -309,9 +309,9 @@ public class MUXlisten implements Runnable {
try {
wlock();
try {
info.add("STARTING", new Boolean(false));
info.add("STOPPING", new Boolean(false));
info.add("RUNNING", new Boolean(false));
info.add("STARTING", Boolean.valueOf(false));
info.add("STOPPING", Boolean.valueOf(false));
info.add("RUNNING", Boolean.valueOf(false));
} catch (Exception e) {
lock.set(false);
wunlock();

View File

@@ -71,6 +71,7 @@ public class TCPtoI2P implements Runnable {
*/
private static String lnRead(InputStream in) throws IOException {
String S = "";
StringBuilder builder = new StringBuilder();
int b;
char c;
@@ -85,9 +86,9 @@ public class TCPtoI2P implements Runnable {
break;
}
c = (char) (b & 0x7f); // We only care about ASCII
S = S + c;
builder.append(c);
}
return S;
return builder.toString();
}
/**

View File

@@ -305,8 +305,8 @@ public class SAMStreamSession {
}
synchronized (handlersMapLock) {
handlersMap.put(new Integer(id), reader);
sendersMap.put(new Integer(id), sender);
handlersMap.put(Integer.valueOf(id), reader);
sendersMap.put(Integer.valueOf(id), sender);
}
I2PAppThread t = new I2PAppThread(reader, "SAMReader" + id);
@@ -332,12 +332,12 @@ public class SAMStreamSession {
*/
protected SAMStreamSessionSocketReader getSocketReader ( int id ) {
synchronized (handlersMapLock) {
return handlersMap.get(new Integer(id));
return handlersMap.get(Integer.valueOf(id));
}
}
private StreamSender getSender(int id) {
synchronized (handlersMapLock) {
return sendersMap.get(new Integer(id));
return sendersMap.get(Integer.valueOf(id));
}
}
@@ -349,7 +349,7 @@ public class SAMStreamSession {
*/
protected boolean checkSocketHandlerId ( int id ) {
synchronized (handlersMapLock) {
return (!(handlersMap.get(new Integer(id)) == null));
return (!(handlersMap.get(Integer.valueOf(id)) == null));
}
}
@@ -363,8 +363,8 @@ public class SAMStreamSession {
StreamSender sender = null;
synchronized (handlersMapLock) {
reader = handlersMap.remove(new Integer(id));
sender = sendersMap.remove(new Integer(id));
reader = handlersMap.remove(Integer.valueOf(id));
sender = sendersMap.remove(Integer.valueOf(id));
}
if (reader != null)

View File

@@ -189,6 +189,7 @@ public class SAMUtils {
/* Dump a Properties object in an human-readable form */
private static String dumpProperties(Properties props) {
Enumeration names = props.propertyNames();
StringBuilder builder = new StringBuilder();
String msg = "";
String key, val;
boolean firstIter = true;
@@ -202,10 +203,10 @@ public class SAMUtils {
} else {
firstIter = false;
}
msg += " \"" + key + "\" -> \"" + val + "\"";
builder.append(" \"" + key + "\" -> \"" + val + "\"");
}
return msg;
return builder.toString();
}
/****

View File

@@ -218,7 +218,7 @@ public class SAMv3Handler extends SAMv1Handler
public SessionRecord( String dest, Properties props, SAMv3Handler handler )
{
m_dest = new String(dest) ;
m_dest = dest;
m_props = new Properties() ;
m_props.putAll(props);
m_threadgroup = null ;
@@ -235,7 +235,7 @@ public class SAMv3Handler extends SAMv1Handler
synchronized public String getDest()
{
return new String(m_dest) ;
return m_dest;
}
synchronized public Properties getProps()
{