Merge pull request #115 from wenshao/master

修正sonar规则检查中发现的违例警告
This commit is contained in:
温高铁
2012-08-28 21:26:52 -07:00
7 changed files with 17 additions and 48 deletions
@@ -864,9 +864,6 @@ public class WebAppStat {
osWindows2000Count.incrementAndGet();
} else if (userAgent.startsWith("Windows NT 5.0", 25)) {
osWindows2000Count.incrementAndGet();
} else {
System.out.print("");
}
}
@@ -889,8 +886,6 @@ public class WebAppStat {
osWindowsXPCount.incrementAndGet();
} else if (userAgent.startsWith("Windows XP", 34)) {
osWindowsXPCount.incrementAndGet();
} else {
System.out.print("");
}
}
@@ -118,7 +118,7 @@ public class IPAddress implements Cloneable {
* @exception InvalidIPAddressException Throws this exception when the specified string doesn't represent a valid IP
* address.
*/
public IPAddress(String ipAddressStr) {
public IPAddress(String ipAddressStr){
ipAddress = parseIPAddress(ipAddressStr);
}
@@ -212,7 +212,7 @@ public class IPAddress implements Cloneable {
* @exception InvalidIPAddressException Throws this exception if the specified IP address is not compliant to the
* decimal-dotted notation xxx.xxx.xxx.xxx.
*/
protected int parseIPAddress(String ipAddressStr) {
final int parseIPAddress(String ipAddressStr) {
int result = 0;
if (ipAddressStr == null) {
@@ -269,35 +269,15 @@ public class IPAddress implements Cloneable {
return result;
}
public int hashCode () {
public int hashCode() {
return this.ipAddress;
}
public boolean equals(Object another) {
if (another instanceof IPAddress) {
return ipAddress == ((IPAddress) another).ipAddress;
}
return false;
}
public Object clone() {
return new IPAddress(ipAddress);
}
public static void main(String[] args) {
System.out.println(Integer.toBinaryString(255));
// try {//"192.168.1.1"
// IPAddress ip = new IPAddress(Integer.toBinaryString(3));
// System.out.println(ip.getIPAddress());
// System.out.println(ip.toString());
// System.out.println(ip.parseIPAddress("192.168.4.4"));
// } catch (InvalidIPAddressException e) {
// e.printStackTrace();
// }
}
}
@@ -193,7 +193,7 @@ public class IPRange {
* @param range String representation of the IP range.
* @exception InvalidIPRangeException Throws this exception if the specified range is not a valid IP network range.
*/
protected void parseRange(String range) {
final void parseRange(String range) {
if (range == null) {
throw new IllegalArgumentException("Invalid IP range");
}
@@ -153,7 +153,7 @@ public class JSONParser {
throw new IllegalArgumentException("illegal token : " + token + ", expect " + token);
}
void nextToken() {
final void nextToken() {
if (index == Integer.MIN_VALUE) {
token = Token.EOF;
return;