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
@@ -36,21 +36,15 @@ public class DruidDataSourceC3P0Adapter implements DataSource, DruidDataSourceC3
dataSource = new DruidDataSource();
// setDefault
this.setInitialPoolSize(3);
this.setAcquireIncrement(3);
this.setAcquireIncrement(30);
this.setAcquireRetryDelay(1000);
this.setAutoCommitOnClose(true);
this.setAutomaticTestTable(null);
this.setCheckoutTimeout(0);
this.setDebugUnreturnedConnectionStackTraces(false);
this.setMaxIdleTime(0);
this.setMaxPoolSize(15);
this.setMaxStatements(0);
this.setMaxStatementsPerConnection(0);
this.setMinPoolSize(3);
this.setTestConnectionOnCheckin(false);
this.setTestConnectionOnCheckout(false);
dataSource.setInitialSize(3);
acquireIncrement = 3;
dataSource.setTimeBetweenConnectErrorMillis(1000);
dataSource.setDefaultAutoCommit(true);
dataSource.setLogAbandoned(false);
dataSource.setMaxActive(15);
dataSource.setMinIdle(3);
dataSource.setTestOnReturn(false);
dataSource.setTestOnBorrow(false);
}
@Override
@@ -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;
@@ -39,7 +39,7 @@ import java.util.concurrent.locks.ReentrantLock;
* @param <K> the type of keys maintained by this map
* @param <V> the type of mapped values
*/
public class ConcurrentIdentityHashMap<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> {
public final class ConcurrentIdentityHashMap<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> {
/**
* The default initial capacity for this table, used when not otherwise specified in a constructor.
@@ -90,7 +90,7 @@ public class WallConfig implements WallConfigMBean {
this.dir = dir;
}
public void init() {
public final void init() {
loadConfig(dir);
}