Skip to content

Commit f3a3520

Browse files
committed
org.apache.commons.dbutils.ResultSetIterator.next() now throws
NoSuchElementException as defined in java.util.Iterator.next() See also PR apache#283
1 parent 27ca6db commit f3a3520

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/org/apache/commons/dbutils/ResultSetIterator.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,10 @@ public boolean hasNext() {
106106
public Object[] next() {
107107
if (hasNext()) {
108108
try {
109-
resultSet.next();
110-
return this.convert.toArray(resultSet);
109+
if (resultSet.next()) {
110+
return convert.toArray(resultSet);
111+
}
112+
throw new NoSuchElementException("No more rows in the ResultSet");
111113
} catch (final SQLException e) {
112114
rethrow(e);
113115
return null;

0 commit comments

Comments
 (0)