commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 32120] - [dbutils] ResultSetIterator should rethrow SQLExceptions as RuntimException
Date Tue, 30 Nov 2004 21:26:14 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32120>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32120





------- Additional Comments From stefan.fleiter@web.de  2004-11-30 22:26 -------
The reason for this is that one may need to distinguish the Exception from other
RuntimeExceptions thrown by ones try-Block.

Now you can wrap your code with something like this (beware: not tested!):
try {
    while (iter.hasNext()) {
        // do something
    }
} catch (SQLRuntimeException e) {
    SQLException org = (SQLException) e.getCause();
    throw new SQLException(org.getMessage(), org.getSQLState(), 
            org.getErrorCode());
}

It's the same reason we do not only distinguish between Exception and
RuntimeException but have subclasses like IllegalArgumentException.

Where is the problem with having another class, what does it cost?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
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