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

View File

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

View File

@@ -71,6 +71,7 @@ public class TCPtoI2P implements Runnable {
*/ */
private static String lnRead(InputStream in) throws IOException { private static String lnRead(InputStream in) throws IOException {
String S = ""; String S = "";
StringBuilder builder = new StringBuilder();
int b; int b;
char c; char c;
@@ -85,9 +86,9 @@ public class TCPtoI2P implements Runnable {
break; break;
} }
c = (char) (b & 0x7f); // We only care about ASCII 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) { synchronized (handlersMapLock) {
handlersMap.put(new Integer(id), reader); handlersMap.put(Integer.valueOf(id), reader);
sendersMap.put(new Integer(id), sender); sendersMap.put(Integer.valueOf(id), sender);
} }
I2PAppThread t = new I2PAppThread(reader, "SAMReader" + id); I2PAppThread t = new I2PAppThread(reader, "SAMReader" + id);
@@ -332,12 +332,12 @@ public class SAMStreamSession {
*/ */
protected SAMStreamSessionSocketReader getSocketReader ( int id ) { protected SAMStreamSessionSocketReader getSocketReader ( int id ) {
synchronized (handlersMapLock) { synchronized (handlersMapLock) {
return handlersMap.get(new Integer(id)); return handlersMap.get(Integer.valueOf(id));
} }
} }
private StreamSender getSender(int id) { private StreamSender getSender(int id) {
synchronized (handlersMapLock) { 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 ) { protected boolean checkSocketHandlerId ( int id ) {
synchronized (handlersMapLock) { 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; StreamSender sender = null;
synchronized (handlersMapLock) { synchronized (handlersMapLock) {
reader = handlersMap.remove(new Integer(id)); reader = handlersMap.remove(Integer.valueOf(id));
sender = sendersMap.remove(new Integer(id)); sender = sendersMap.remove(Integer.valueOf(id));
} }
if (reader != null) if (reader != null)

View File

@@ -189,6 +189,7 @@ public class SAMUtils {
/* Dump a Properties object in an human-readable form */ /* Dump a Properties object in an human-readable form */
private static String dumpProperties(Properties props) { private static String dumpProperties(Properties props) {
Enumeration names = props.propertyNames(); Enumeration names = props.propertyNames();
StringBuilder builder = new StringBuilder();
String msg = ""; String msg = "";
String key, val; String key, val;
boolean firstIter = true; boolean firstIter = true;
@@ -202,10 +203,10 @@ public class SAMUtils {
} else { } else {
firstIter = false; 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 ) public SessionRecord( String dest, Properties props, SAMv3Handler handler )
{ {
m_dest = new String(dest) ; m_dest = dest;
m_props = new Properties() ; m_props = new Properties() ;
m_props.putAll(props); m_props.putAll(props);
m_threadgroup = null ; m_threadgroup = null ;
@@ -235,7 +235,7 @@ public class SAMv3Handler extends SAMv1Handler
synchronized public String getDest() synchronized public String getDest()
{ {
return new String(m_dest) ; return m_dest;
} }
synchronized public Properties getProps() synchronized public Properties getProps()
{ {