commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dfabul...@apache.org
Subject svn commit: r741990 - in /commons/sandbox/dbutils/java5: ./ src/java/org/apache/commons/dbutils/ src/java/org/apache/commons/dbutils/handlers/ src/java/org/apache/commons/dbutils/wrappers/ src/test/org/apache/commons/dbutils/
Date Sun, 08 Feb 2009 01:27:53 GMT
Author: dfabulich
Date: Sun Feb  8 01:27:53 2009
New Revision: 741990

URL: http://svn.apache.org/viewvc?rev=741990&view=rev
Log:
Committing initial java5 patch

Modified:
    commons/sandbox/dbutils/java5/pom.xml
    commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/BasicRowProcessor.java
    commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/BeanProcessor.java
    commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/ProxyFactory.java
    commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/QueryLoader.java
    commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/QueryRunner.java
    commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/ResultSetHandler.java
    commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/ResultSetIterator.java
    commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/RowProcessor.java
    commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/ArrayHandler.java
    commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/ArrayListHandler.java
    commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/BeanHandler.java
    commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/BeanListHandler.java
    commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/ColumnListHandler.java
    commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/GenericListHandler.java
    commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/KeyedHandler.java
    commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/MapHandler.java
    commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/MapListHandler.java
    commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/ScalarHandler.java
    commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java
    commons/sandbox/dbutils/java5/src/test/org/apache/commons/dbutils/BasicRowProcessorTest.java
    commons/sandbox/dbutils/java5/src/test/org/apache/commons/dbutils/MockResultSet.java
    commons/sandbox/dbutils/java5/src/test/org/apache/commons/dbutils/QueryLoaderTest.java
    commons/sandbox/dbutils/java5/src/test/org/apache/commons/dbutils/ResultSetIteratorTest.java

Modified: commons/sandbox/dbutils/java5/pom.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/dbutils/java5/pom.xml?rev=741990&r1=741989&r2=741990&view=diff
==============================================================================
--- commons/sandbox/dbutils/java5/pom.xml (original)
+++ commons/sandbox/dbutils/java5/pom.xml Sun Feb  8 01:27:53 2009
@@ -27,7 +27,7 @@
   <modelVersion>4.0.0</modelVersion>
   <groupId>commons-dbutils</groupId>
   <artifactId>commons-dbutils</artifactId>
-  <version>1.2-SNAPSHOT</version>
+  <version>2.0-SNAPSHOT</version>
   <name>Commons DbUtils</name>
 
   <inceptionYear>2002</inceptionYear>
@@ -203,6 +203,13 @@
             <tarLongFileMode>gnu</tarLongFileMode>
           </configuration>
         </plugin>
+        <plugin>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <configuration>
+            <source>1.5</source>
+            <target>1.5</target>
+          </configuration>
+        </plugin>
       </plugins>
     </build>
 

Modified: commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/BasicRowProcessor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/BasicRowProcessor.java?rev=741990&r1=741989&r2=741990&view=diff
==============================================================================
--- commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/BasicRowProcessor.java (original)
+++ commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/BasicRowProcessor.java Sun Feb  8 01:27:53 2009
@@ -20,7 +20,6 @@
 import java.sql.ResultSetMetaData;
 import java.sql.SQLException;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -107,7 +106,7 @@
      * @see org.apache.commons.dbutils.RowProcessor#toBean(java.sql.ResultSet, java.lang.Class)
      * @see org.apache.commons.dbutils.BeanProcessor#toBean(java.sql.ResultSet, java.lang.Class) 
      */
-    public Object toBean(ResultSet rs, Class type) throws SQLException {
+    public <T> T toBean(ResultSet rs, Class<T> type) throws SQLException {
         return this.convert.toBean(rs, type);
     }
 
@@ -117,7 +116,7 @@
      * @see org.apache.commons.dbutils.RowProcessor#toBeanList(java.sql.ResultSet, java.lang.Class)
      * @see org.apache.commons.dbutils.BeanProcessor#toBeanList(java.sql.ResultSet, java.lang.Class)
      */
-    public List toBeanList(ResultSet rs, Class type) throws SQLException {
+    public <T> List<T> toBeanList(ResultSet rs, Class<T> type) throws SQLException {
         return this.convert.toBeanList(rs, type);
     }
 
@@ -128,8 +127,8 @@
      * <code>map.get("col")</code> return the same value.
      * @see org.apache.commons.dbutils.RowProcessor#toMap(java.sql.ResultSet)
      */
-    public Map toMap(ResultSet rs) throws SQLException {
-        Map result = new CaseInsensitiveHashMap();
+    public Map<String, Object> toMap(ResultSet rs) throws SQLException {
+        Map<String, Object> result = new CaseInsensitiveHashMap();
         ResultSetMetaData rsmd = rs.getMetaData();
         int cols = rsmd.getColumnCount();
 
@@ -145,7 +144,7 @@
      * lookups.  This is needed for the toMap() implementation because 
      * databases don't consistenly handle the casing of column names. 
      */
-    private static class CaseInsensitiveHashMap extends HashMap {
+    private static class CaseInsensitiveHashMap extends HashMap<String, Object> {
 
         /**
          * Required for serialization support.
@@ -157,6 +156,7 @@
         /**
          * @see java.util.Map#containsKey(java.lang.Object)
          */
+        @Override
         public boolean containsKey(Object key) {
             return super.containsKey(key.toString().toLowerCase());
         }
@@ -164,6 +164,7 @@
         /**
          * @see java.util.Map#get(java.lang.Object)
          */
+        @Override
         public Object get(Object key) {
             return super.get(key.toString().toLowerCase());
         }
@@ -171,17 +172,17 @@
         /**
          * @see java.util.Map#put(java.lang.Object, java.lang.Object)
          */
-        public Object put(Object key, Object value) {
-            return super.put(key.toString().toLowerCase(), value);
+        @Override
+        public Object put(String key, Object value) {
+            return super.put(key.toLowerCase(), value);
         }
 
         /**
          * @see java.util.Map#putAll(java.util.Map)
          */
-        public void putAll(Map m) {
-            Iterator iter = m.keySet().iterator();
-            while (iter.hasNext()) {
-                Object key = iter.next();
+        @Override
+        public void putAll(Map<? extends String, ?> m) {
+            for (String key : m.keySet()) {
                 Object value = m.get(key);
                 this.put(key, value);
             }
@@ -190,6 +191,7 @@
         /**
          * @see java.util.Map#remove(java.lang.Object)
          */
+        @Override
         public Object remove(Object key) {
             return super.remove(key.toString().toLowerCase());
         }

Modified: commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/BeanProcessor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/BeanProcessor.java?rev=741990&r1=741989&r2=741990&view=diff
==============================================================================
--- commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/BeanProcessor.java (original)
+++ commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/BeanProcessor.java Sun Feb  8 01:27:53 2009
@@ -62,7 +62,7 @@
      * is returned.  These are the same as the defaults that ResultSet get* 
      * methods return in the event of a NULL column.
      */
-    private static final Map primitiveDefaults = new HashMap();
+    private static final Map<Class<?>, Object> primitiveDefaults = new HashMap<Class<?>, Object>();
 
     static {
         primitiveDefaults.put(Integer.TYPE, new Integer(0));
@@ -115,7 +115,7 @@
      * @throws SQLException if a database access error occurs
      * @return the newly created bean
      */
-    public Object toBean(ResultSet rs, Class type) throws SQLException {
+    public <T> T toBean(ResultSet rs, Class<T> type) throws SQLException {
 
         PropertyDescriptor[] props = this.propertyDescriptors(type);
 
@@ -158,8 +158,8 @@
      * @throws SQLException if a database access error occurs
      * @return the newly created List of beans
      */
-    public List toBeanList(ResultSet rs, Class type) throws SQLException {
-        List results = new ArrayList();
+    public <T> List<T> toBeanList(ResultSet rs, Class<T> type) throws SQLException {
+        List<T> results = new ArrayList<T>();
 
         if (!rs.next()) {
             return results;
@@ -186,11 +186,11 @@
      * @return An initialized object.
      * @throws SQLException if a database error occurs.
      */
-    private Object createBean(ResultSet rs, Class type,
+    private <T> T createBean(ResultSet rs, Class<T> type,
             PropertyDescriptor[] props, int[] columnToProperty)
             throws SQLException {
 
-        Object bean = this.newInstance(type);
+        T bean = this.newInstance(type);
 
         for (int i = 1; i < columnToProperty.length; i++) {
 
@@ -199,7 +199,7 @@
             }
             
             PropertyDescriptor prop = props[columnToProperty[i]];
-            Class propType = prop.getPropertyType();
+            Class<?> propType = prop.getPropertyType();
 
             Object value = this.processColumn(rs, i, propType);
 
@@ -230,7 +230,7 @@
             return;
         }
 
-        Class[] params = setter.getParameterTypes();
+        Class<?>[] params = setter.getParameterTypes();
         try {
             // convert types for some popular ones
             if (value != null) {
@@ -280,7 +280,7 @@
      * @param type The setter's parameter type.
      * @return boolean True if the value is compatible.
      */
-    private boolean isCompatibleType(Object value, Class type) {
+    private boolean isCompatibleType(Object value, Class<?> type) {
         // Do object check first, then primitives
         if (value == null || type.isInstance(value)) {
             return true;
@@ -329,7 +329,7 @@
      * @return A newly created object of the Class.
      * @throws SQLException if creation failed.
      */
-    protected Object newInstance(Class c) throws SQLException {
+    protected <T> T newInstance(Class<T> c) throws SQLException {
         try {
             return c.newInstance();
 
@@ -350,7 +350,7 @@
      * @return A PropertyDescriptor[] describing the Class.
      * @throws SQLException if introspection failed.
      */
-    private PropertyDescriptor[] propertyDescriptors(Class c)
+    private PropertyDescriptor[] propertyDescriptors(Class<?> c)
         throws SQLException {
         // Introspector caches BeanInfo classes for better performance
         BeanInfo beanInfo = null;
@@ -430,7 +430,7 @@
      * index after optional type processing or <code>null</code> if the column
      * value was SQL NULL.
      */
-    protected Object processColumn(ResultSet rs, int index, Class propType)
+    protected Object processColumn(ResultSet rs, int index, Class<?> propType)
         throws SQLException {
 
         if (propType.equals(String.class)) {

Modified: commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/ProxyFactory.java
URL: http://svn.apache.org/viewvc/commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/ProxyFactory.java?rev=741990&r1=741989&r2=741990&view=diff
==============================================================================
--- commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/ProxyFactory.java (original)
+++ commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/ProxyFactory.java Sun Feb  8 01:27:53 2009
@@ -37,52 +37,11 @@
 public class ProxyFactory {
 
     /**
-     * Class[] for CallableStatement interface.
-     */
-    private static final Class[] callableStatementClass =
-        new Class[] { CallableStatement.class };
-
-    /**
-     * Class[] for Connection interface.
-     */
-    private static final Class[] connectionClass =
-        new Class[] { Connection.class };
-
-    /**
-     * Class[] for Driver interface.
-     */
-    private static final Class[] driverClass = new Class[] { Driver.class };
-
-    /**
      * The Singleton instance of this class.
      */
     private static final ProxyFactory instance = new ProxyFactory();
 
     /**
-     * Class[] for ResultSetMetaData interface.
-     */
-    private static final Class[] metaClass =
-        new Class[] { ResultSetMetaData.class };
-
-    /**
-     * Class[] for PreparedStatement interface.
-     */
-    private static final Class[] preparedStatementClass =
-        new Class[] { PreparedStatement.class };
-
-    /**
-     * Class[] for ResultSet interface.
-     */
-    private static final Class[] resultSetClass =
-        new Class[] { ResultSet.class };
-
-    /**
-     * Class[] for Statement interface.
-     */
-    private static final Class[] statementClass =
-        new Class[] { Statement.class };
-
-    /**
      * Returns the Singleton instance of this class.
      *
      * @return singleton instance
@@ -98,16 +57,24 @@
         super();
     }
 
+    /** Convenience method to generate a single-interface proxy using the handler's classloader
+     * 
+     * @param <T> The type of object to proxy
+     * @param type The type of object to proxy
+     * @param handler The handler that intercepts/overrides method calls. 
+     * @return proxied object
+     */
+    public <T> T newProxyInstance(Class<T> type, InvocationHandler handler) {
+        return type.cast(Proxy.newProxyInstance(handler.getClass().getClassLoader(), new Class<?>[] {type}, handler));
+    }
+    
     /**
      * Creates a new proxy <code>CallableStatement</code> object.
      * @param handler The handler that intercepts/overrides method calls.
      * @return proxied CallableStatement
      */
     public CallableStatement createCallableStatement(InvocationHandler handler) {
-        return (CallableStatement) Proxy.newProxyInstance(
-            handler.getClass().getClassLoader(),
-            callableStatementClass,
-            handler);
+        return newProxyInstance(CallableStatement.class, handler);
     }
 
     /**
@@ -116,10 +83,7 @@
      * @return proxied Connection
      */
     public Connection createConnection(InvocationHandler handler) {
-        return (Connection) Proxy.newProxyInstance(
-            handler.getClass().getClassLoader(),
-            connectionClass,
-            handler);
+        return newProxyInstance(Connection.class, handler);
     }
 
     /**
@@ -128,10 +92,7 @@
      * @return proxied Driver
      */
     public Driver createDriver(InvocationHandler handler) {
-        return (Driver) Proxy.newProxyInstance(
-            handler.getClass().getClassLoader(),
-            driverClass,
-            handler);
+        return newProxyInstance(Driver.class, handler);
     }
 
     /**
@@ -140,10 +101,7 @@
      * @return proxied PreparedStatement
      */
     public PreparedStatement createPreparedStatement(InvocationHandler handler) {
-        return (PreparedStatement) Proxy.newProxyInstance(
-            handler.getClass().getClassLoader(),
-            preparedStatementClass,
-            handler);
+        return newProxyInstance(PreparedStatement.class, handler);
     }
 
     /**
@@ -152,10 +110,7 @@
      * @return proxied ResultSet
      */
     public ResultSet createResultSet(InvocationHandler handler) {
-        return (ResultSet) Proxy.newProxyInstance(
-            handler.getClass().getClassLoader(),
-            resultSetClass,
-            handler);
+        return newProxyInstance(ResultSet.class, handler);
     }
 
     /**
@@ -164,10 +119,7 @@
      * @return proxied ResultSetMetaData
      */
     public ResultSetMetaData createResultSetMetaData(InvocationHandler handler) {
-        return (ResultSetMetaData) Proxy.newProxyInstance(
-            handler.getClass().getClassLoader(),
-            metaClass,
-            handler);
+        return newProxyInstance(ResultSetMetaData.class, handler);
     }
 
     /**
@@ -176,10 +128,7 @@
      * @return proxied Statement
      */
     public Statement createStatement(InvocationHandler handler) {
-        return (Statement) Proxy.newProxyInstance(
-            handler.getClass().getClassLoader(),
-            statementClass,
-            handler);
+        return newProxyInstance(Statement.class, handler);
     }
 
 }

Modified: commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/QueryLoader.java
URL: http://svn.apache.org/viewvc/commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/QueryLoader.java?rev=741990&r1=741989&r2=741990&view=diff
==============================================================================
--- commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/QueryLoader.java (original)
+++ commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/QueryLoader.java Sun Feb  8 01:27:53 2009
@@ -46,7 +46,7 @@
     /**
      * Maps query set names to Maps of their queries.
      */
-    private Map queries = new HashMap();
+    private Map<String,Map<String,String>> queries = new HashMap<String, Map<String,String>>();
 
     /**
      * QueryLoader constructor.
@@ -69,9 +69,9 @@
      * the given path.
      * @return Map of query names to SQL values
      */
-    public synchronized Map load(String path) throws IOException {
+    public synchronized Map<String,String> load(String path) throws IOException {
 
-        Map queryMap = (Map) this.queries.get(path);
+        Map<String,String> queryMap = (Map<String,String>) this.queries.get(path);
 
         if (queryMap == null) {
             queryMap = this.loadQueries(path);
@@ -91,7 +91,8 @@
      * @since DbUtils 1.1
      * @return Map of query names to SQL values
      */
-    protected Map loadQueries(String path) throws IOException {
+    @SuppressWarnings("unchecked")
+    protected Map<String,String> loadQueries(String path) throws IOException {
         InputStream in = getClass().getResourceAsStream(path);
 
         if (in == null) {

Modified: commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/QueryRunner.java
URL: http://svn.apache.org/viewvc/commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/QueryRunner.java?rev=741990&r1=741989&r2=741990&view=diff
==============================================================================
--- commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/QueryRunner.java (original)
+++ commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/QueryRunner.java Sun Feb  8 01:27:53 2009
@@ -85,7 +85,7 @@
             rows = stmt.executeBatch();
 
         } catch (SQLException e) {
-            this.rethrow(e, sql, params);
+            this.rethrow(e, sql, (Object[])params);
         } finally {
             close(stmt);
         }
@@ -124,7 +124,7 @@
      * value to pass in.
      * @throws SQLException if a database access error occurs
      */
-    protected void fillStatement(PreparedStatement stmt, Object[] params)
+    protected void fillStatement(PreparedStatement stmt, Object... params)
         throws SQLException {
 
         if (params == null) {
@@ -205,11 +205,12 @@
      * @param rsh The handler that converts the results into an object.
      * @return The object returned by the handler.
      * @throws SQLException if a database access error occurs
+     * @deprecated Use {@link #query(Connection,String,ResultSetHandler<T>,Object...)} instead
      */
-    public Object query(Connection conn, String sql, Object param,
-            ResultSetHandler rsh) throws SQLException {
+    public <T> T query(Connection conn, String sql, Object param,
+            ResultSetHandler<T> rsh) throws SQLException {
 
-        return this.query(conn, sql, new Object[] { param }, rsh);
+        return this.query(conn, sql, rsh, new Object[] { param });
     }
 
     /**
@@ -222,13 +223,30 @@
      * @param rsh The handler that converts the results into an object.
      * @return The object returned by the handler.
      * @throws SQLException if a database access error occurs
+     * @deprecated Use {@link #query(Connection,String,ResultSetHandler<T>,Object...)} instead
      */
-    public Object query(Connection conn, String sql, Object[] params,
-            ResultSetHandler rsh) throws SQLException {
+    public <T> T query(Connection conn, String sql, Object[] params,
+            ResultSetHandler<T> rsh) throws SQLException {
+                return query(conn, sql, rsh, params);
+            }
+
+    /**
+     * Execute an SQL SELECT query with replacement parameters.  The
+     * caller is responsible for closing the connection.
+     * 
+     * @param conn The connection to execute the query in.
+     * @param sql The query to execute.
+     * @param rsh The handler that converts the results into an object.
+     * @param params The replacement parameters.
+     * @return The object returned by the handler.
+     * @throws SQLException if a database access error occurs
+     */
+    public <T> T query(Connection conn, String sql, ResultSetHandler<T> rsh,
+            Object... params) throws SQLException {
 
         PreparedStatement stmt = null;
         ResultSet rs = null;
-        Object result = null;
+        T result = null;
 
         try {
             stmt = this.prepareStatement(conn, sql);
@@ -260,10 +278,10 @@
      * @return The object returned by the handler.
      * @throws SQLException if a database access error occurs
      */
-    public Object query(Connection conn, String sql, ResultSetHandler rsh)
+    public <T> T query(Connection conn, String sql, ResultSetHandler<T> rsh)
         throws SQLException {
 
-        return this.query(conn, sql, (Object[]) null, rsh);
+        return this.query(conn, sql, rsh, (Object[]) null);
     }
 
     /**
@@ -278,11 +296,12 @@
      * 
      * @return An object generated by the handler.
      * @throws SQLException if a database access error occurs
+     * @deprecated Use {@link #query(String, ResultSetHandler, Object...)}
      */
-    public Object query(String sql, Object param, ResultSetHandler rsh)
+    public <T> T query(String sql, Object param, ResultSetHandler<T> rsh)
         throws SQLException {
 
-        return this.query(sql, new Object[] { param }, rsh);
+        return this.query(sql, rsh, new Object[] { param });
     }
 
     /**
@@ -299,14 +318,33 @@
      * 
      * @return An object generated by the handler.
      * @throws SQLException if a database access error occurs
+     * @deprecated Use {@link #query(String, ResultSetHandler, Object...)}
+     */
+    public <T> T query(String sql, Object[] params, ResultSetHandler<T> rsh)
+        throws SQLException {
+            return query(sql, rsh, params);
+        }
+
+    /**
+     * Executes the given SELECT SQL query and returns a result object.
+     * The <code>Connection</code> is retrieved from the 
+     * <code>DataSource</code> set in the constructor.
+     * 
+     * @param sql The SQL statement to execute.
+     * @param rsh The handler used to create the result object from 
+     * the <code>ResultSet</code>.
+     * @param params Initialize the PreparedStatement's IN parameters with 
+     * this array.
+     * @return An object generated by the handler.
+     * @throws SQLException if a database access error occurs
      */
-    public Object query(String sql, Object[] params, ResultSetHandler rsh)
+    public <T> T query(String sql, ResultSetHandler<T> rsh, Object... params)
         throws SQLException {
 
         Connection conn = this.prepareConnection();
 
         try {
-            return this.query(conn, sql, params, rsh);
+            return this.query(conn, sql, rsh, params);
         } finally {
             close(conn);
         }
@@ -324,8 +362,8 @@
      * @return An object generated by the handler.
      * @throws SQLException if a database access error occurs
      */
-    public Object query(String sql, ResultSetHandler rsh) throws SQLException {
-        return this.query(sql, (Object[]) null, rsh);
+    public <T> T query(String sql, ResultSetHandler<T> rsh) throws SQLException {
+        return this.query(sql, rsh, (Object[]) null);
     }
 
     /**
@@ -341,7 +379,7 @@
      * 
      * @throws SQLException if a database access error occurs
      */
-    protected void rethrow(SQLException cause, String sql, Object[] params)
+    protected void rethrow(SQLException cause, String sql, Object... params)
         throws SQLException {
 
         StringBuffer msg = new StringBuffer(cause.getMessage());
@@ -413,7 +451,7 @@
      * @return The number of rows updated.
      * @throws SQLException if a database access error occurs
      */
-    public int update(Connection conn, String sql, Object[] params)
+    public int update(Connection conn, String sql, Object... params)
         throws SQLException {
 
         PreparedStatement stmt = null;
@@ -477,7 +515,7 @@
      * @throws SQLException if a database access error occurs
      * @return The number of rows updated.
      */
-    public int update(String sql, Object[] params) throws SQLException {
+    public int update(String sql, Object... params) throws SQLException {
         Connection conn = this.prepareConnection();
 
         try {

Modified: commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/ResultSetHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/ResultSetHandler.java?rev=741990&r1=741989&r2=741990&view=diff
==============================================================================
--- commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/ResultSetHandler.java (original)
+++ commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/ResultSetHandler.java Sun Feb  8 01:27:53 2009
@@ -22,7 +22,7 @@
 /**
  * Implementations of this interface convert ResultSets into other objects.
  */
-public interface ResultSetHandler {
+public interface ResultSetHandler<T> {
 
     /**
      * Turn the <code>ResultSet</code> into an Object.
@@ -36,6 +36,6 @@
      * 
      * @throws SQLException if a database access error occurs
      */
-    public Object handle(ResultSet rs) throws SQLException;
+    public T handle(ResultSet rs) throws SQLException;
 
 }
\ No newline at end of file

Modified: commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/ResultSetIterator.java
URL: http://svn.apache.org/viewvc/commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/ResultSetIterator.java?rev=741990&r1=741989&r2=741990&view=diff
==============================================================================
--- commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/ResultSetIterator.java (original)
+++ commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/ResultSetIterator.java Sun Feb  8 01:27:53 2009
@@ -22,7 +22,7 @@
 
 /**
  * <p>
- * Wraps a <code>ResultSet</code> in an <code>Iterator</code>.  This is useful
+ * Wraps a <code>ResultSet</code> in an <code>Iterator<Object[]></code>.  This is useful
  * when you want to present a non-database application layer with domain
  * neutral data.
  * </p>
@@ -32,24 +32,24 @@
  * to be implemented.
  * </p>
  */
-public class ResultSetIterator implements Iterator {
+public class ResultSetIterator implements Iterator<Object[]> {
 
     /**
      * The wrapped <code>ResultSet</code>.
      */
-    private ResultSet rs = null;
+    private final ResultSet rs;
     
     /**
      * The processor to use when converting a row into an Object[].
      */
-    private RowProcessor convert = new BasicRowProcessor();
+    private final RowProcessor convert;
 
     /**
      * Constructor for ResultSetIterator.
      * @param rs Wrap this <code>ResultSet</code> in an <code>Iterator</code>.
      */
     public ResultSetIterator(ResultSet rs) {
-        this.rs = rs;
+        this(rs, new BasicRowProcessor());
     }
     
     /**
@@ -85,7 +85,7 @@
      * @see java.util.Iterator#next()
      * @throws RuntimeException if an SQLException occurs.
      */
-    public Object next() {
+    public Object[] next() {
         try {
             rs.next();
             return this.convert.toArray(rs);
@@ -118,4 +118,21 @@
         throw new RuntimeException(e.getMessage());
     }
 
+    /** Generates an <code>Iterable</code>, suitable for use in for-each loops. 
+     * 
+     * @param <T> the type of the bean to create
+     * @param rs Wrap this <code>ResultSet</code> in an <code>Iterator</code>.
+     * @param type The type of bean to create
+     * @return an <code>Iterable</code>, suitable for use in for-each loops.
+     */
+    public static Iterable<Object[]> iterable(final ResultSet rs) {
+        return new Iterable<Object[]>() {
+
+            public Iterator<Object[]> iterator() {
+                return new ResultSetIterator(rs);
+            }
+            
+        };
+    }
+    
 }

Modified: commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/RowProcessor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/RowProcessor.java?rev=741990&r1=741989&r2=741990&view=diff
==============================================================================
--- commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/RowProcessor.java (original)
+++ commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/RowProcessor.java Sun Feb  8 01:27:53 2009
@@ -55,7 +55,7 @@
      * @throws SQLException if a database access error occurs
      * @return the newly created bean
      */
-    public Object toBean(ResultSet rs, Class type) throws SQLException;
+    public <T> T toBean(ResultSet rs, Class<T> type) throws SQLException;
 
     /**
      * Create a <code>List</code> of JavaBeans from the column values in all 
@@ -68,7 +68,7 @@
      * @return A <code>List</code> of beans with the given type in the order 
      * they were returned by the <code>ResultSet</code>.
      */
-    public List toBeanList(ResultSet rs, Class type) throws SQLException;
+    public <T> List<T> toBeanList(ResultSet rs, Class<T> type) throws SQLException;
 
     /**
      * Create a <code>Map</code> from the column values in one 
@@ -81,6 +81,6 @@
      * @throws SQLException if a database access error occurs
      * @return the newly created Map
      */
-    public Map toMap(ResultSet rs) throws SQLException;
+    public Map<String, Object> toMap(ResultSet rs) throws SQLException;
 
 }

Modified: commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/ArrayHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/ArrayHandler.java?rev=741990&r1=741989&r2=741990&view=diff
==============================================================================
--- commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/ArrayHandler.java (original)
+++ commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/ArrayHandler.java Sun Feb  8 01:27:53 2009
@@ -30,7 +30,7 @@
  * 
  * @see org.apache.commons.dbutils.ResultSetHandler
  */
-public class ArrayHandler implements ResultSetHandler {
+public class ArrayHandler implements ResultSetHandler<Object[]> {
 
     /**
      * Singleton processor instance that handlers share to save memory.  Notice
@@ -73,7 +73,7 @@
      * @throws SQLException if a database access error occurs
      * @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet)
      */
-    public Object handle(ResultSet rs) throws SQLException {
+    public Object[] handle(ResultSet rs) throws SQLException {
         return rs.next() ? this.convert.toArray(rs) : null;
     }
 

Modified: commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/ArrayListHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/ArrayListHandler.java?rev=741990&r1=741989&r2=741990&view=diff
==============================================================================
--- commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/ArrayListHandler.java (original)
+++ commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/ArrayListHandler.java Sun Feb  8 01:27:53 2009
@@ -28,7 +28,7 @@
  * 
  * @see org.apache.commons.dbutils.ResultSetHandler
  */
-public class ArrayListHandler extends GenericListHandler {
+public class ArrayListHandler extends GenericListHandler<Object[]> {
 
     /**
      * The RowProcessor implementation to use when converting rows 
@@ -64,7 +64,7 @@
      * @throws SQLException if a database access error occurs
      * @see org.apache.commons.dbutils.handlers.GenericListHandler#handle(ResultSet)
      */
-    protected Object handleRow(ResultSet rs) throws SQLException {
+    protected Object[] handleRow(ResultSet rs) throws SQLException {
         return this.convert.toArray(rs);
     }
 

Modified: commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/BeanHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/BeanHandler.java?rev=741990&r1=741989&r2=741990&view=diff
==============================================================================
--- commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/BeanHandler.java (original)
+++ commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/BeanHandler.java Sun Feb  8 01:27:53 2009
@@ -28,12 +28,12 @@
  * 
  * @see org.apache.commons.dbutils.ResultSetHandler
  */
-public class BeanHandler implements ResultSetHandler {
+public class BeanHandler<T> implements ResultSetHandler<T> {
 
     /**
      * The Class of beans produced by this handler.
      */
-    private Class type = null;
+    private Class<T> type = null;
 
     /**
      * The RowProcessor implementation to use when converting rows 
@@ -47,7 +47,7 @@
      * @param type The Class that objects returned from <code>handle()</code>
      * are created from.
      */
-    public BeanHandler(Class type) {
+    public BeanHandler(Class<T> type) {
         this.type = type;
     }
 
@@ -59,7 +59,7 @@
      * @param convert The <code>RowProcessor</code> implementation 
      * to use when converting rows into beans.
      */
-    public BeanHandler(Class type, RowProcessor convert) {
+    public BeanHandler(Class<T> type, RowProcessor convert) {
         this.type = type;
         this.convert = convert;
     }
@@ -74,7 +74,7 @@
      * @throws SQLException if a database access error occurs
      * @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet)
      */
-    public Object handle(ResultSet rs) throws SQLException {
+    public T handle(ResultSet rs) throws SQLException {
         return rs.next() ? this.convert.toBean(rs, this.type) : null;
     }
 

Modified: commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/BeanListHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/BeanListHandler.java?rev=741990&r1=741989&r2=741990&view=diff
==============================================================================
--- commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/BeanListHandler.java (original)
+++ commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/BeanListHandler.java Sun Feb  8 01:27:53 2009
@@ -28,12 +28,12 @@
  * 
  * @see org.apache.commons.dbutils.ResultSetHandler
  */
-public class BeanListHandler extends GenericListHandler {
+public class BeanListHandler<T> extends GenericListHandler<T> {
 
     /**
      * The Class of beans produced by this handler.
      */
-    private Class type = null;
+    private Class<T> type = null;
 
     /**
      * The RowProcessor implementation to use when converting rows 
@@ -47,7 +47,7 @@
      * @param type The Class that objects returned from <code>handle()</code>
      * are created from.
      */
-    public BeanListHandler(Class type) {
+    public BeanListHandler(Class<T> type) {
         this.type = type;
     }
 
@@ -59,7 +59,7 @@
      * @param convert The <code>RowProcessor</code> implementation 
      * to use when converting rows into beans.
      */
-    public BeanListHandler(Class type, RowProcessor convert) {
+    public BeanListHandler(Class<T> type, RowProcessor convert) {
         this.type = type;
         this.convert = convert;
     }
@@ -73,7 +73,7 @@
      * @throws SQLException if a database access error occurs
      * @see org.apache.commons.dbutils.handlers.GenericListHandler#handle(ResultSet)
      */
-    protected Object handleRow(ResultSet rs) throws SQLException {
+    protected T handleRow(ResultSet rs) throws SQLException {
         return this.convert.toBean(rs, type);
     }
 

Modified: commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/ColumnListHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/ColumnListHandler.java?rev=741990&r1=741989&r2=741990&view=diff
==============================================================================
--- commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/ColumnListHandler.java (original)
+++ commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/ColumnListHandler.java Sun Feb  8 01:27:53 2009
@@ -27,7 +27,7 @@
  * @see org.apache.commons.dbutils.ResultSetHandler
  * @since DbUtils 1.1
  */
-public class ColumnListHandler extends GenericListHandler {
+public class ColumnListHandler extends GenericListHandler<Object> {
 
     /**
      * The column number to retrieve.

Modified: commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/GenericListHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/GenericListHandler.java?rev=741990&r1=741989&r2=741990&view=diff
==============================================================================
--- commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/GenericListHandler.java (original)
+++ commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/GenericListHandler.java Sun Feb  8 01:27:53 2009
@@ -29,7 +29,7 @@
  *
  * @see org.apache.commons.dbutils.ResultSetHandler
  */
-abstract class GenericListHandler implements ResultSetHandler {
+abstract class GenericListHandler<T> implements ResultSetHandler<List<T>> {
     /**
      * Whole <code>ResultSet</code> handler. It produce <code>List</code> as
      * result. To convert individual rows into Java objects it uses
@@ -37,8 +37,8 @@
      *
      * @see #handleRow(ResultSet)
      */
-    public Object handle(ResultSet rs) throws SQLException {
-        List rows = new ArrayList();
+    public List<T> handle(ResultSet rs) throws SQLException {
+        List<T> rows = new ArrayList<T>();
         while (rs.next()) {
             rows.add(this.handleRow(rs));
         }
@@ -52,5 +52,5 @@
      * @return row processing result
      * @throws SQLException error occurs
      */
-    protected abstract Object handleRow(ResultSet rs) throws SQLException;
+    protected abstract T handleRow(ResultSet rs) throws SQLException;
 }

Modified: commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/KeyedHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/KeyedHandler.java?rev=741990&r1=741989&r2=741990&view=diff
==============================================================================
--- commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/KeyedHandler.java (original)
+++ commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/KeyedHandler.java Sun Feb  8 01:27:53 2009
@@ -57,7 +57,7 @@
  * @see org.apache.commons.dbutils.ResultSetHandler
  * @since DbUtils 1.1
  */
-public class KeyedHandler implements ResultSetHandler {
+public class KeyedHandler implements ResultSetHandler<Map<Object,Map<String,Object>>> {
 
     /**
      * The RowProcessor implementation to use when converting rows
@@ -126,8 +126,8 @@
      * @throws SQLException if a database access error occurs
      * @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet)
      */
-    public Object handle(ResultSet rs) throws SQLException {
-        Map result = createMap();
+    public Map<Object,Map<String,Object>> handle(ResultSet rs) throws SQLException {
+        Map<Object,Map<String,Object>> result = createMap();
         while (rs.next()) {
             result.put(createKey(rs), createRow(rs));
         }
@@ -141,8 +141,8 @@
      *
      * @return Map to store records in
      */
-    protected Map createMap() {
-        return new HashMap();
+    protected Map<Object,Map<String,Object>> createMap() {
+        return new HashMap<Object,Map<String,Object>>();
     }
 
     /**
@@ -169,7 +169,7 @@
      * @return Object typed Map containing column names to values
      * @throws SQLException if a database access error occurs
      */
-    protected Object createRow(ResultSet rs) throws SQLException {
+    protected Map<String,Object> createRow(ResultSet rs) throws SQLException {
         return this.convert.toMap(rs);
     }
 

Modified: commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/MapHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/MapHandler.java?rev=741990&r1=741989&r2=741990&view=diff
==============================================================================
--- commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/MapHandler.java (original)
+++ commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/MapHandler.java Sun Feb  8 01:27:53 2009
@@ -18,6 +18,7 @@
 
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.util.Map;
 
 import org.apache.commons.dbutils.ResultSetHandler;
 import org.apache.commons.dbutils.RowProcessor;
@@ -29,7 +30,7 @@
  * 
  * @see org.apache.commons.dbutils.ResultSetHandler
  */
-public class MapHandler implements ResultSetHandler {
+public class MapHandler implements ResultSetHandler<Map<String,Object>> {
 
     /**
      * The RowProcessor implementation to use when converting rows 
@@ -67,7 +68,7 @@
      * 
      * @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet)
      */
-    public Object handle(ResultSet rs) throws SQLException {
+    public Map<String,Object> handle(ResultSet rs) throws SQLException {
         return rs.next() ? this.convert.toMap(rs) : null;
     }
 

Modified: commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/MapListHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/MapListHandler.java?rev=741990&r1=741989&r2=741990&view=diff
==============================================================================
--- commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/MapListHandler.java (original)
+++ commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/MapListHandler.java Sun Feb  8 01:27:53 2009
@@ -18,6 +18,7 @@
 
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.util.Map;
 
 import org.apache.commons.dbutils.RowProcessor;
 
@@ -28,7 +29,7 @@
  * 
  * @see org.apache.commons.dbutils.ResultSetHandler
  */
-public class MapListHandler extends GenericListHandler {
+public class MapListHandler extends GenericListHandler<Map<String,Object>> {
 
     /**
      * The RowProcessor implementation to use when converting rows 
@@ -64,7 +65,7 @@
      * 
      * @see org.apache.commons.dbutils.handlers.GenericListHandler#handle(ResultSet)
      */
-    protected Object handleRow(ResultSet rs) throws SQLException {
+    protected Map<String,Object> handleRow(ResultSet rs) throws SQLException {
         return this.convert.toMap(rs);
     }
 

Modified: commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/ScalarHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/ScalarHandler.java?rev=741990&r1=741989&r2=741990&view=diff
==============================================================================
--- commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/ScalarHandler.java (original)
+++ commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/ScalarHandler.java Sun Feb  8 01:27:53 2009
@@ -27,7 +27,7 @@
  * 
  * @see org.apache.commons.dbutils.ResultSetHandler
  */
-public class ScalarHandler implements ResultSetHandler {
+public class ScalarHandler implements ResultSetHandler<Object> {
 
     /**
      * The column number to retrieve.

Modified: commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java
URL: http://svn.apache.org/viewvc/commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java?rev=741990&r1=741989&r2=741990&view=diff
==============================================================================
--- commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java (original)
+++ commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java Sun Feb  8 01:27:53 2009
@@ -73,7 +73,7 @@
      * Maps normal method names (ie. "getBigDecimal") to the corresponding null
      * Method object (ie. getNullBigDecimal).
      */
-    private static final Map nullMethods = new HashMap();
+    private static final Map<String,Method> nullMethods = new HashMap<String,Method>();
 
     static {
         Method[] methods = SqlNullCheckedResultSet.class.getMethods();

Modified: commons/sandbox/dbutils/java5/src/test/org/apache/commons/dbutils/BasicRowProcessorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/dbutils/java5/src/test/org/apache/commons/dbutils/BasicRowProcessorTest.java?rev=741990&r1=741989&r2=741990&view=diff
==============================================================================
--- commons/sandbox/dbutils/java5/src/test/org/apache/commons/dbutils/BasicRowProcessorTest.java (original)
+++ commons/sandbox/dbutils/java5/src/test/org/apache/commons/dbutils/BasicRowProcessorTest.java Sun Feb  8 01:27:53 2009
@@ -89,7 +89,7 @@
 
     public void testToBeanList() throws SQLException, ParseException {
 
-        List list = processor.toBeanList(this.rs, TestBean.class);
+        List<TestBean> list = processor.toBeanList(this.rs, TestBean.class);
         assertNotNull(list);
         assertEquals(ROWS, list.size());
 
@@ -112,7 +112,7 @@
     public void testToMap() throws SQLException {
 
         int rowCount = 0;
-        Map m = null;
+        Map<String,Object> m = null;
         while (this.rs.next()) {
             m = processor.toMap(this.rs);
             assertNotNull(m);

Modified: commons/sandbox/dbutils/java5/src/test/org/apache/commons/dbutils/MockResultSet.java
URL: http://svn.apache.org/viewvc/commons/sandbox/dbutils/java5/src/test/org/apache/commons/dbutils/MockResultSet.java?rev=741990&r1=741989&r2=741990&view=diff
==============================================================================
--- commons/sandbox/dbutils/java5/src/test/org/apache/commons/dbutils/MockResultSet.java (original)
+++ commons/sandbox/dbutils/java5/src/test/org/apache/commons/dbutils/MockResultSet.java Sun Feb  8 01:27:53 2009
@@ -24,6 +24,7 @@
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Iterator;
+import java.util.List;
 
 /**
  * MockResultSet dynamically implements the ResultSet interface.
@@ -47,7 +48,7 @@
 
     private Object[] currentRow = null;
 
-    private Iterator iter = null;
+    private Iterator<Object[]> iter = null;
 
     private ResultSetMetaData metaData = null;
 
@@ -61,9 +62,12 @@
     public MockResultSet(ResultSetMetaData metaData, Object[][] rows) {
         super();
         this.metaData = metaData;
-        this.iter = (rows == null)
-                ? Collections.EMPTY_LIST.iterator()
-                : Arrays.asList(rows).iterator();
+        if (rows == null) {
+            List<Object[]> empty = Collections.emptyList(); 
+            this.iter = empty.iterator();
+        } else {
+            this.iter = Arrays.asList(rows).iterator();
+        }
     }
 
     /**

Modified: commons/sandbox/dbutils/java5/src/test/org/apache/commons/dbutils/QueryLoaderTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/dbutils/java5/src/test/org/apache/commons/dbutils/QueryLoaderTest.java?rev=741990&r1=741989&r2=741990&view=diff
==============================================================================
--- commons/sandbox/dbutils/java5/src/test/org/apache/commons/dbutils/QueryLoaderTest.java (original)
+++ commons/sandbox/dbutils/java5/src/test/org/apache/commons/dbutils/QueryLoaderTest.java Sun Feb  8 01:27:53 2009
@@ -37,13 +37,13 @@
     public void testLoad() throws IOException {
         try {
             QueryLoader loader = QueryLoader.instance();
-            Map q = loader.load(QUERIES);
-            Map q2 = loader.load(QUERIES);
+            Map<String,String> q = loader.load(QUERIES);
+            Map<String,String> q2 = loader.load(QUERIES);
             assertTrue(q == q2); // pointer comparison should return true
             assertEquals("SELECT * FROM SomeTable", q.get("test.query"));
 
             loader.unload(QUERIES);
-            Map q3 = loader.load(QUERIES);
+            Map<String,String> q3 = loader.load(QUERIES);
             assertTrue(q != q3); // pointer comparison should return false
 
         } catch (IllegalArgumentException e) {

Modified: commons/sandbox/dbutils/java5/src/test/org/apache/commons/dbutils/ResultSetIteratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/dbutils/java5/src/test/org/apache/commons/dbutils/ResultSetIteratorTest.java?rev=741990&r1=741989&r2=741990&view=diff
==============================================================================
--- commons/sandbox/dbutils/java5/src/test/org/apache/commons/dbutils/ResultSetIteratorTest.java (original)
+++ commons/sandbox/dbutils/java5/src/test/org/apache/commons/dbutils/ResultSetIteratorTest.java Sun Feb  8 01:27:53 2009
@@ -33,7 +33,7 @@
 
 	public void testNext() {
 		
-		Iterator iter = new ResultSetIterator(this.rs);
+		Iterator<Object[]> iter = new ResultSetIterator(this.rs);
 
 		int rowCount = 0;
 		Object[] row = null;



Mime
View raw message