This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch 1.X
in repository https://gitbox.apache.org/repos/asf/commons-beanutils.git

commit 54696927b3b736031ae57d16dd25e098b72facf1
Author: Gary D. Gregory <garydgreg...@gmail.com>
AuthorDate: Mon Apr 28 16:17:00 2025 -0400

    ResultSetIterator.get(String) now throws IllegalArgumentException
    instead of RuntimeException to wrap cases of SQLException
    
    - ResultSetIterator.hasNext() now throws IllegalArgumentException
    instead of RuntimeException to wrap cases of SQLException
    - ResultSetIterator.set(String, Object) now throws
    IllegalArgumentException instead of RuntimeException to wrap cases of
    SQLException
    - ResultSetIterator.set(String, String, Object) now throws
    IllegalArgumentException instead of RuntimeException to wrap cases of
    SQLException.</action>
---
 src/changes/changes.xml                                     |  4 ++++
 .../org/apache/commons/beanutils/ResultSetIterator.java     | 13 +++++--------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 77a10c3f..af012f3c 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -32,6 +32,10 @@
       <!-- FIX -->
       <action type="fix" dev="ggregory" due-to="Gary 
Gregory">BeanComparator.compare(T, T) now throws IllegalArgumentException 
instead of RuntimeException to wrap all cases of 
ReflectiveOperationException.</action>
       <action type="fix" dev="ggregory" due-to="Gary 
Gregory">MappedMethodReference.get() now throws IllegalStateException instead 
of RuntimeException to wrap cases of NoSuchMethodException.</action>
+      <action type="fix" dev="ggregory" due-to="Gary 
Gregory">ResultSetIterator.get(String) now throws IllegalArgumentException 
instead of RuntimeException to wrap cases of SQLException.</action>
+      <action type="fix" dev="ggregory" due-to="Gary 
Gregory">ResultSetIterator.hasNext() now throws IllegalArgumentException 
instead of RuntimeException to wrap cases of SQLException.</action>
+      <action type="fix" dev="ggregory" due-to="Gary 
Gregory">ResultSetIterator.set(String, Object) now throws 
IllegalArgumentException instead of RuntimeException to wrap cases of 
SQLException.</action>
+      <action type="fix" dev="ggregory" due-to="Gary 
Gregory">ResultSetIterator.set(String, String, Object) now throws 
IllegalArgumentException instead of RuntimeException to wrap cases of 
SQLException.</action>
       <!-- ADD -->
       <!-- UPDATE -->
     </release>
diff --git a/src/main/java/org/apache/commons/beanutils/ResultSetIterator.java 
b/src/main/java/org/apache/commons/beanutils/ResultSetIterator.java
index c076e9dc..cb20bad6 100644
--- a/src/main/java/org/apache/commons/beanutils/ResultSetIterator.java
+++ b/src/main/java/org/apache/commons/beanutils/ResultSetIterator.java
@@ -110,8 +110,7 @@ public class ResultSetIterator implements DynaBean, 
Iterator<DynaBean> {
         try {
             return dynaClass.getObjectFromResultSet(name);
         } catch (final SQLException e) {
-            throw new RuntimeException
-                ("get(" + name + "): SQLException: " + e);
+            throw new IllegalArgumentException("get(" + name + "): 
SQLException: " + e, e);
         }
     }
 
@@ -177,7 +176,7 @@ public class ResultSetIterator implements DynaBean, 
Iterator<DynaBean> {
             advance();
             return !eof;
         } catch (final SQLException e) {
-            throw new RuntimeException("hasNext():  SQLException:  " + e);
+            throw new IllegalArgumentException("hasNext():  SQLException:  " + 
e, e);
         }
     }
 
@@ -196,7 +195,7 @@ public class ResultSetIterator implements DynaBean, 
Iterator<DynaBean> {
             current = false;
             return this;
         } catch (final SQLException e) {
-            throw new RuntimeException("next():  SQLException:  " + e);
+            throw new IllegalArgumentException("next():  SQLException:  " + e, 
e);
         }
 
     }
@@ -267,8 +266,7 @@ public class ResultSetIterator implements DynaBean, 
Iterator<DynaBean> {
         try {
             dynaClass.getResultSet().updateObject(name, value);
         } catch (final SQLException e) {
-            throw new RuntimeException
-                ("set(" + name + "): SQLException: " + e);
+            throw new IllegalArgumentException("set(" + name + "): 
SQLException: " + e, e);
         }
     }
 
@@ -287,8 +285,7 @@ public class ResultSetIterator implements DynaBean, 
Iterator<DynaBean> {
      */
     @Override
     public void set(final String name, final String key, final Object value) {
-        throw new UnsupportedOperationException
-            ("FIXME - mapped properties not currently supported");
+        throw new UnsupportedOperationException("FIXME - mapped properties not 
currently supported");
     }
 
 }

Reply via email to