commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgra...@apache.org
Subject cvs commit: jakarta-commons-sandbox/dbutils/src/test/org/apache/commons/dbutils MockResultSet.java
Date Thu, 23 Oct 2003 01:13:33 GMT
dgraham     2003/10/22 18:13:33

  Modified:    dbutils/src/test/org/apache/commons/dbutils
                        MockResultSet.java
  Log:
  A null Object[][] indicates an empty result set.
  
  Revision  Changes    Path
  1.3       +15 -9     jakarta-commons-sandbox/dbutils/src/test/org/apache/commons/dbutils/MockResultSet.java
  
  Index: MockResultSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/dbutils/src/test/org/apache/commons/dbutils/MockResultSet.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MockResultSet.java	22 Oct 2003 23:54:53 -0000	1.2
  +++ MockResultSet.java	23 Oct 2003 01:13:33 -0000	1.3
  @@ -66,6 +66,7 @@
   import java.sql.ResultSet;
   import java.sql.ResultSetMetaData;
   import java.util.Arrays;
  +import java.util.Collections;
   import java.util.Iterator;
   
   /**
  @@ -75,8 +76,6 @@
    */
   class MockResultSet implements InvocationHandler {
   
  -	private Object[] rows = null;
  -
   	private ResultSetMetaData metaData = null;
   
   	private Iterator iter = null;
  @@ -92,22 +91,29 @@
   	 * </pre>
   	 * 
   	 * @param metaData
  -	 * @param rows
  +	 * @param rows A null value indicates an empty <code>ResultSet</code>.
   	 * @return
   	 */
   	public static ResultSet create(
   		ResultSetMetaData metaData,
   		Object[][] rows) {
  -            
  +
   		return ProxyFactory.instance().createResultSet(
   			new MockResultSet(metaData, rows));
   	}
   
  +    /**
  +     * MockResultSet constructor.
  +     * @param metaData
  +     * @param rows A null value indicates an empty <code>ResultSet</code>.
  +     */
   	public MockResultSet(ResultSetMetaData metaData, Object[][] rows) {
   		super();
   		this.metaData = metaData;
  -		this.rows = rows;
  -		this.iter = Arrays.asList(rows).iterator();
  +		this.iter =
  +			(rows == null)
  +				? Collections.EMPTY_LIST.iterator()
  +				: Arrays.asList(rows).iterator();
   	}
   
   	public Object invoke(Object proxy, Method method, Object[] args)
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message