forked from I2P_Developers/i2p.i2p
Findbugs: A stab at squashing some issues across the board. Probably more to follow.
This commit is contained in:
@ -71,7 +71,7 @@ abstract class IRCFilter {
|
|||||||
|
|
||||||
// Allow numerical responses
|
// Allow numerical responses
|
||||||
try {
|
try {
|
||||||
new Integer(command);
|
Integer.valueOf(command);
|
||||||
return s;
|
return s;
|
||||||
} catch(NumberFormatException nfe){}
|
} catch(NumberFormatException nfe){}
|
||||||
|
|
||||||
|
@ -104,19 +104,20 @@ public class SOCKS4aServer extends SOCKSServer {
|
|||||||
throw new SOCKSException("Invalid port number in request");
|
throw new SOCKSException("Invalid port number in request");
|
||||||
}
|
}
|
||||||
|
|
||||||
connHostName = new String("");
|
StringBuilder builder = new StringBuilder();
|
||||||
boolean alreadyWarned = false;
|
boolean alreadyWarned = false;
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
int octet = in.readByte() & 0xff;
|
int octet = in.readByte() & 0xff;
|
||||||
connHostName += Integer.toString(octet);
|
builder.append(Integer.toString(octet));
|
||||||
if (i != 3) {
|
if (i != 3) {
|
||||||
connHostName += ".";
|
builder.append(".");
|
||||||
if (octet != 0 && !alreadyWarned) {
|
if (octet != 0 && !alreadyWarned) {
|
||||||
_log.warn("IPV4 address type in request: " + connHostName + ". Is your client secure?");
|
_log.warn("IPV4 address type in request: " + connHostName + ". Is your client secure?");
|
||||||
alreadyWarned = true;
|
alreadyWarned = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
connHostName = builder.toString();
|
||||||
|
|
||||||
// Check if the requested IP should be mapped to a domain name
|
// Check if the requested IP should be mapped to a domain name
|
||||||
String mappedDomainName = getMappedDomainNameForIP(connHostName);
|
String mappedDomainName = getMappedDomainNameForIP(connHostName);
|
||||||
|
@ -198,14 +198,16 @@ public class SOCKS5Server extends SOCKSServer {
|
|||||||
addressType = in.readUnsignedByte();
|
addressType = in.readUnsignedByte();
|
||||||
switch (addressType) {
|
switch (addressType) {
|
||||||
case AddressType.IPV4:
|
case AddressType.IPV4:
|
||||||
connHostName = new String("");
|
//connHostName = new String();
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
int octet = in.readUnsignedByte();
|
int octet = in.readUnsignedByte();
|
||||||
connHostName += Integer.toString(octet);
|
builder.append(Integer.toString(octet));
|
||||||
if (i != 3) {
|
if (i != 3) {
|
||||||
connHostName += ".";
|
builder.append(".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
connHostName = builder.toString();
|
||||||
// Check if the requested IP should be mapped to a domain name
|
// Check if the requested IP should be mapped to a domain name
|
||||||
String mappedDomainName = getMappedDomainNameForIP(connHostName);
|
String mappedDomainName = getMappedDomainNameForIP(connHostName);
|
||||||
if (mappedDomainName != null) {
|
if (mappedDomainName != null) {
|
||||||
|
@ -238,10 +238,7 @@ public class PcapWriter {
|
|||||||
seq = pkt.getSequenceNum();
|
seq = pkt.getSequenceNum();
|
||||||
long acked = 0;
|
long acked = 0;
|
||||||
if (con != null) {
|
if (con != null) {
|
||||||
if (isInbound)
|
acked = getLowestAckedThrough(pkt, con);
|
||||||
acked = getLowestAckedThrough(pkt, con);
|
|
||||||
else
|
|
||||||
acked = getLowestAckedThrough(pkt, con);
|
|
||||||
}
|
}
|
||||||
DataHelper.writeLong(_fos, 4, pkt.getSequenceNum());
|
DataHelper.writeLong(_fos, 4, pkt.getSequenceNum());
|
||||||
DataHelper.writeLong(_fos, 4, acked);
|
DataHelper.writeLong(_fos, 4, acked);
|
||||||
|
@ -209,14 +209,15 @@ public class Log {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// catenate all toString()s
|
// catenate all toString()s
|
||||||
String descString = "close() loop in";
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("close() loop in");
|
||||||
for (Object o : desc) {
|
for (Object o : desc) {
|
||||||
descString += " ";
|
builder.append(" ");
|
||||||
descString += String.valueOf(o);
|
builder.append(String.valueOf(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
Exception e = new Exception("check stack trace");
|
Exception e = new Exception("check stack trace");
|
||||||
log(level,descString,e);
|
log(level,builder.toString(),e);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
@ -526,7 +526,8 @@ public class Blocklist {
|
|||||||
if (pib == null) continue;
|
if (pib == null) continue;
|
||||||
// O(n**2)
|
// O(n**2)
|
||||||
for (int i = 0; i < rv.size(); i++) {
|
for (int i = 0; i < rv.size(); i++) {
|
||||||
if (DataHelper.eq(rv.get(i), pib)) continue;
|
// findbugs triggered on this, looks like unfinished work
|
||||||
|
//if (DataHelper.eq(rv.get(i), pib)) continue;
|
||||||
}
|
}
|
||||||
rv.add(pib);
|
rv.add(pib);
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ class FloodfillMonitorJob extends JobImpl {
|
|||||||
final RouterContext rc = getContext();
|
final RouterContext rc = getContext();
|
||||||
final String log = String.format(
|
final String log = String.format(
|
||||||
"FF criteria breakdown: happy=%b, capabilities=%s, maxLag=%d, known=%d, " +
|
"FF criteria breakdown: happy=%b, capabilities=%s, maxLag=%d, known=%d, " +
|
||||||
"active=%d, participating=%d, offset=%d, ssuAddr=%b",
|
"active=%d, participating=%d, offset=%d, ssuAddr=%s",
|
||||||
happy,
|
happy,
|
||||||
rc.router().getRouterInfo().getCapabilities(),
|
rc.router().getRouterInfo().getCapabilities(),
|
||||||
rc.jobQueue().getMaxLag(),
|
rc.jobQueue().getMaxLag(),
|
||||||
@ -154,7 +154,7 @@ class FloodfillMonitorJob extends JobImpl {
|
|||||||
rc.commSystem().countActivePeers(),
|
rc.commSystem().countActivePeers(),
|
||||||
rc.tunnelManager().getParticipatingCount(),
|
rc.tunnelManager().getParticipatingCount(),
|
||||||
Math.abs(rc.clock().getOffset()),
|
Math.abs(rc.clock().getOffset()),
|
||||||
rc.router().getRouterInfo().getTargetAddress("SSU")
|
rc.router().getRouterInfo().getTargetAddress("SSU").toString()
|
||||||
);
|
);
|
||||||
_log.debug(log);
|
_log.debug(log);
|
||||||
}
|
}
|
||||||
|
@ -415,7 +415,7 @@ class UPnP extends ControlPoint implements DeviceChangeListener, EventListener {
|
|||||||
if(getIP == null || !getIP.postControlAction())
|
if(getIP == null || !getIP.postControlAction())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return Integer.valueOf(getIP.getOutputArgumentList().getArgument("NewUpstreamMaxBitRate").getValue());
|
return Integer.parseInt(getIP.getOutputArgumentList().getArgument("NewUpstreamMaxBitRate").getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -429,7 +429,7 @@ class UPnP extends ControlPoint implements DeviceChangeListener, EventListener {
|
|||||||
if(getIP == null || !getIP.postControlAction())
|
if(getIP == null || !getIP.postControlAction())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return Integer.valueOf(getIP.getOutputArgumentList().getArgument("NewDownstreamMaxBitRate").getValue());
|
return Integer.parseInt(getIP.getOutputArgumentList().getArgument("NewDownstreamMaxBitRate").getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** debug only */
|
/** debug only */
|
||||||
|
Reference in New Issue
Block a user