commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r1090737 - in /commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils: ./ handlers/ wrappers/
Date Sun, 10 Apr 2011 04:41:29 GMT
Author: bayard
Date: Sun Apr 10 04:41:29 2011
New Revision: 1090737

URL: http://svn.apache.org/viewvc?rev=1090737&view=rev
Log:
Applying findbugs based patch from DBUTILS-75

Modified:
    commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/BaseTestCase.java
    commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/BasicRowProcessorTest.java
    commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/MockResultSet.java
    commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/MockResultSetMetaData.java
    commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java
    commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/TestBean.java
    commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/KeyedHandlerTest.java
    commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSetTest.java

Modified: commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/BaseTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/BaseTestCase.java?rev=1090737&r1=1090736&r2=1090737&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/BaseTestCase.java (original)
+++ commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/BaseTestCase.java Sun
Apr 10 04:41:29 2011
@@ -56,8 +56,8 @@ public class BaseTestCase extends TestCa
             "2",
             "3",
             "  notInBean  ",
-            new Integer(1),
-            new Integer(2),
+            Integer.valueOf(1),
+            Integer.valueOf(2),
             null,
             null,
             new Date(),
@@ -69,8 +69,8 @@ public class BaseTestCase extends TestCa
             "5",
             "6",
             "  notInBean  ",
-            new Integer(3),
-            new Integer(4),
+            Integer.valueOf(3),
+            Integer.valueOf(4),
             null,
             null,
             new Date(),

Modified: commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/BasicRowProcessorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/BasicRowProcessorTest.java?rev=1090737&r1=1090736&r2=1090737&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/BasicRowProcessorTest.java
(original)
+++ commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/BasicRowProcessorTest.java
Sun Apr 10 04:41:29 2011
@@ -77,7 +77,7 @@ public class BasicRowProcessorTest exten
         assertEquals("6", row.getThree());
         assertEquals("not set", row.getDoNotSet());
         assertEquals(3, row.getIntTest());
-        assertEquals(new Integer(4), row.getIntegerTest());
+        assertEquals(Integer.valueOf(4), row.getIntegerTest());
         assertEquals(null, row.getNullObjectTest());
         assertEquals(0, row.getNullPrimitiveTest());
         // test date -> string handling
@@ -107,7 +107,7 @@ public class BasicRowProcessorTest exten
         assertEquals("6", b.getThree());
         assertEquals("not set", b.getDoNotSet());
         assertEquals(3, b.getIntTest());
-        assertEquals(new Integer(4), b.getIntegerTest());
+        assertEquals(Integer.valueOf(4), b.getIntegerTest());
         assertEquals(null, b.getNullObjectTest());
         assertEquals(0, b.getNullPrimitiveTest());
         // test date -> string handling

Modified: commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/MockResultSet.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/MockResultSet.java?rev=1090737&r1=1090736&r2=1090737&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/MockResultSet.java (original)
+++ commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/MockResultSet.java Sun
Apr 10 04:41:29 2011
@@ -137,7 +137,7 @@ public class MockResultSet implements In
 
         try {
             return (obj == null)
-                ? new Byte((byte) 0)
+                ? Byte.valueOf((byte) 0)
                 : Byte.valueOf(obj.toString());
 
         } catch (NumberFormatException e) {
@@ -192,7 +192,7 @@ public class MockResultSet implements In
 
         try {
             return (obj == null)
-                ? new Integer(0)
+                ? Integer.valueOf(0)
                 : Integer.valueOf(obj.toString());
 
         } catch (NumberFormatException e) {
@@ -210,7 +210,7 @@ public class MockResultSet implements In
         this.setWasNull(obj);
 
         try {
-            return (obj == null) ? new Long(0) : Long.valueOf(obj.toString());
+            return (obj == null) ? Long.valueOf(0) : Long.valueOf(obj.toString());
 
         } catch (NumberFormatException e) {
             throw new SQLException(e.getMessage());
@@ -243,7 +243,7 @@ public class MockResultSet implements In
 
         try {
             return (obj == null)
-                ? new Short((short) 0)
+                ? Short.valueOf((short) 0)
                 : Short.valueOf(obj.toString());
 
         } catch (NumberFormatException e) {
@@ -311,7 +311,7 @@ public class MockResultSet implements In
             return this.isLast();
         
         } else if (methodName.equals("hashCode")) {
-            return new Integer(System.identityHashCode(proxy));
+            return Integer.valueOf(System.identityHashCode(proxy));
         
         } else if (methodName.equals("toString")) {
             return "MockResultSet " + System.identityHashCode(proxy);

Modified: commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/MockResultSetMetaData.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/MockResultSetMetaData.java?rev=1090737&r1=1090736&r2=1090737&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/MockResultSetMetaData.java
(original)
+++ commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/MockResultSetMetaData.java
Sun Apr 10 04:41:29 2011
@@ -64,7 +64,7 @@ public class MockResultSetMetaData imple
         String methodName = method.getName();
 
         if (methodName.equals("getColumnCount")) {
-            return new Integer(this.columnNames.length);
+            return Integer.valueOf(this.columnNames.length);
 
         } else if (
                 methodName.equals("getColumnName")) {
@@ -79,7 +79,7 @@ public class MockResultSetMetaData imple
                 return this.columnLabels[col];
 
         } else if (methodName.equals("hashCode")) {
-            return new Integer(System.identityHashCode(proxy));
+            return Integer.valueOf(System.identityHashCode(proxy));
 
         } else if (methodName.equals("toString")) {
             return "MockResultSetMetaData " + System.identityHashCode(proxy);

Modified: commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java?rev=1090737&r1=1090736&r2=1090737&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java
(original)
+++ commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java
Sun Apr 10 04:41:29 2011
@@ -80,12 +80,12 @@ public class QueryRunnerTest extends Tes
             public Object invoke(Object proxy, Method method, Object[] args)
                     throws Throwable {
                 if (getParameterCount.equals(method)) {
-                    return new Integer(types.length);
+                    return Integer.valueOf(types.length);
                 }
                 if (getParameterType.equals(method)) {
                     if (simulateOracle) throw new SQLException("Oracle fails when you call
getParameterType");
                     int arg = ((Integer)args[0]).intValue();
-                    return new Integer(types[arg-1]);
+                    return Integer.valueOf(types[arg-1]);
                 }
                 return null;
             }

Modified: commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/TestBean.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/TestBean.java?rev=1090737&r1=1090736&r2=1090737&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/TestBean.java (original)
+++ commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/TestBean.java Sun Apr
10 04:41:29 2011
@@ -29,7 +29,7 @@ public class TestBean {
 
     private int intTest = 0;
 
-    private Integer integerTest = new Integer(0);
+    private Integer integerTest = Integer.valueOf(0);
 
     private String doNotSet = "not set";
 

Modified: commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/KeyedHandlerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/KeyedHandlerTest.java?rev=1090737&r1=1090736&r2=1090737&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/KeyedHandlerTest.java
(original)
+++ commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/KeyedHandlerTest.java
Sun Apr 10 04:41:29 2011
@@ -17,8 +17,8 @@
 package org.apache.commons.dbutils.handlers;
 
 import java.sql.SQLException;
-import java.util.Iterator;
 import java.util.Map;
+import java.util.Map.Entry;
 
 import org.apache.commons.dbutils.BaseTestCase;
 import org.apache.commons.dbutils.ResultSetHandler;
@@ -33,16 +33,15 @@ public class KeyedHandlerTest extends Ba
         assertNotNull(results);
         assertEquals(ROWS, results.size());
 
-        Iterator<Object> iter = results.keySet().iterator();
         Map<String,Object> row = null;
-        while (iter.hasNext()) {
-            Object key = iter.next();
-            assertNotNull(key);
-            row = results.get(key);
+        for(Entry<Object, Map<String, Object>> entry : results.entrySet())
+        {
+        	Object key = entry.getKey();
+        	assertNotNull(key);
+        	row = entry.getValue();
             assertNotNull(row);
             assertEquals(COLS, row.keySet().size());
         }
-
         row = results.get("1");
         assertEquals("1", row.get("one"));
         assertEquals("2", row.get("TWO"));
@@ -56,16 +55,15 @@ public class KeyedHandlerTest extends Ba
         assertNotNull(results);
         assertEquals(ROWS, results.size());
 
-        Iterator<Object> iter = results.keySet().iterator();
         Map<String,Object> row = null;
-        while (iter.hasNext()) {
-            Object key = iter.next();
-            assertNotNull(key);
-            row = results.get(key);
+        for(Entry<Object, Map<String, Object>> entry : results.entrySet())
+        {
+        	Object key = entry.getKey();
+        	assertNotNull(key);
+        	row = entry.getValue();
             assertNotNull(row);
             assertEquals(COLS, row.keySet().size());
         }
-
         row = results.get("5");
         assertEquals("4", row.get("one"));
         assertEquals("5", row.get("TWO"));
@@ -79,16 +77,15 @@ public class KeyedHandlerTest extends Ba
         assertNotNull(results);
         assertEquals(ROWS, results.size());
 
-        Iterator<Object> iter = results.keySet().iterator();
         Map<String,Object> row = null;
-        while (iter.hasNext()) {
-            Object key = iter.next();
-            assertNotNull(key);
-            row = results.get(key);
-            assertNotNull(row);
-            assertEquals(COLS, row.keySet().size());
+        for(Entry<Object, Map<String, Object>> entry : results.entrySet())
+        {
+        	Object key = entry.getKey();
+        	assertNotNull(key);
+        	row = entry.getValue();
+        	assertNotNull(row);
+        	assertEquals(COLS, row.keySet().size());
         }
-
         row = results.get("6");
         assertEquals("4", row.get("one"));
         assertEquals("5", row.get("TWO"));

Modified: commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSetTest.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSetTest.java?rev=1090737&r1=1090736&r2=1090737&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSetTest.java
(original)
+++ commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSetTest.java
Sun Apr 10 04:41:29 2011
@@ -488,7 +488,7 @@ public class SqlNullCheckedResultSetTest
         }
         if (getUrlInt != null && getUrlString != null) {
             assertEquals(null, getUrlInt.invoke(rs, 
-                         new Object[] { new Integer(1) } ) );
+                         new Object[] { Integer.valueOf(1) } ) );
             assertTrue(rs.wasNull());
             assertEquals(null, getUrlString.invoke(rs, 
                          new Object[] { "column" } ) );
@@ -497,7 +497,7 @@ public class SqlNullCheckedResultSetTest
             URL u = new URL("http://www.apache.org");
             rs2.setNullURL(u);
             assertEquals(u, getUrlInt.invoke(rs, 
-                         new Object[] { new Integer(1) } ) );
+                         new Object[] { Integer.valueOf(1) } ) );
             assertEquals(u, getUrlString.invoke(rs, 
                          new Object[] { "column" } ) );
         }
@@ -831,19 +831,19 @@ class SqlNullUncheckedMockResultSet impl
             return Boolean.FALSE;
 
         } else if (returnType.equals(Integer.TYPE)) {
-            return new Integer(0);
+            return Integer.valueOf(0);
 
         } else if (returnType.equals(Short.TYPE)) {
-            return new Short((short) 0);
+            return Short.valueOf((short) 0);
 
         } else if (returnType.equals(Double.TYPE)) {
             return new Double(0);
 
         } else if (returnType.equals(Long.TYPE)) {
-            return new Long(0);
+            return Long.valueOf(0);
 
         } else if (returnType.equals(Byte.TYPE)) {
-            return new Byte((byte) 0);
+            return Byte.valueOf((byte) 0);
 
         } else if (returnType.equals(Float.TYPE)) {
             return new Float(0);



Mime
View raw message