Findbugs: A stab at squashing some issues across the board. Probably more to follow.

This commit is contained in:
dg2-new
2013-11-10 19:04:57 +00:00
parent 18e4c2ac63
commit 0a8f79f0e3
8 changed files with 22 additions and 20 deletions

View File

@@ -71,7 +71,7 @@ abstract class IRCFilter {
// Allow numerical responses
try {
new Integer(command);
Integer.valueOf(command);
return s;
} catch(NumberFormatException nfe){}

View File

@@ -104,19 +104,20 @@ public class SOCKS4aServer extends SOCKSServer {
throw new SOCKSException("Invalid port number in request");
}
connHostName = new String("");
StringBuilder builder = new StringBuilder();
boolean alreadyWarned = false;
for (int i = 0; i < 4; ++i) {
int octet = in.readByte() & 0xff;
connHostName += Integer.toString(octet);
builder.append(Integer.toString(octet));
if (i != 3) {
connHostName += ".";
builder.append(".");
if (octet != 0 && !alreadyWarned) {
_log.warn("IPV4 address type in request: " + connHostName + ". Is your client secure?");
alreadyWarned = true;
}
}
}
connHostName = builder.toString();
// Check if the requested IP should be mapped to a domain name
String mappedDomainName = getMappedDomainNameForIP(connHostName);

View File

@@ -198,14 +198,16 @@ public class SOCKS5Server extends SOCKSServer {
addressType = in.readUnsignedByte();
switch (addressType) {
case AddressType.IPV4:
connHostName = new String("");
//connHostName = new String();
StringBuilder builder = new StringBuilder();
for (int i = 0; i < 4; ++i) {
int octet = in.readUnsignedByte();
connHostName += Integer.toString(octet);
builder.append(Integer.toString(octet));
if (i != 3) {
connHostName += ".";
builder.append(".");
}
}
connHostName = builder.toString();
// Check if the requested IP should be mapped to a domain name
String mappedDomainName = getMappedDomainNameForIP(connHostName);
if (mappedDomainName != null) {