Index: src/java/org/apache/commons/dbutils/ResultSetIterator.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/dbutils/src/java/org/apache/commons/dbutils/ResultSetIterator.java,v
retrieving revision 1.5
diff -u -r1.5 ResultSetIterator.java
--- src/java/org/apache/commons/dbutils/ResultSetIterator.java 19 Dec 2004 03:25:06 -0000 1.5
+++ src/java/org/apache/commons/dbutils/ResultSetIterator.java 13 Feb 2005 17:43:04 -0000
@@ -30,6 +30,11 @@
* This implementation requires the ResultSet.isLast() method
* to be implemented.
*
+ * Every occurence of a SQLException will be wrapped in a
+ * RuntimeException to fullfill the Iterator interface.
+ *
Object[]. Defaults to a
* BasicRowProcessor.
+ * @throws RuntimeException
*/
public ResultSetIterator(ResultSet rs, RowProcessor convert) {
this.rs = rs;
@@ -67,7 +73,7 @@
try {
return !rs.isLast();
} catch (SQLException e) {
- return false;
+ throw new RuntimeException(e);
}
}
@@ -75,6 +81,7 @@
* Returns the next row as an Object[].
* @return An Object[] with the same number of elements as
* columns in the ResultSet.
+ * @throws RuntimeException
* @see java.util.Iterator#next()
*/
public Object next() {
@@ -82,18 +89,20 @@
rs.next();
return this.convert.toArray(rs);
} catch (SQLException e) {
- return null;
+ throw new RuntimeException(e);
}
}
/**
* Deletes the current row from the ResultSet.
+ * @throws RuntimeException
* @see java.util.Iterator#remove()
*/
public void remove() {
try {
this.rs.deleteRow();
} catch (SQLException e) {
+ throw new RuntimeException(e);
}
}