|
Why not just wrap them in RuntimeException and add a note to the javadoc?
Adding an exception class plus a package seems like overkill. 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!): It's the same reason we do not only distinguish between Exception and Where is the problem with having another class, what does it cost? Created an attachment (id=14272)
Rethrow SQLException as plain RuntimeException This patch does what was asked for in comment 2. This may break current users of the iterator whether we throw a RuntimeException
or a subclass of it. I'm hesitant to break backwards compatibility but supressing the exceptions makes the iterator rather useless anyways. IMHO alls current uses of ResultSetIterator are broken because one can not
reliably know whether an exception has happend and data in a traversal of an resultset is incomplete or not. Better fix this now than never. I added a protected rethrow(SQLException) method that throws a RuntimeException.
We can't wrap the SQLException because our minimum Java level is 1.3. You can subclass and override rethrow() to throw any exception you like. This should be in the next nightly build. Making the type of Exception overrideable by implementing a protected rethrow
method is simple an ingenious at the same time. Thanks a lot. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Patch for rethrowing SQLException as SQLRuntimeException in
ResultSetIterator.java
Three things which are controversial:
1. A subpackage named exceptions for only one class
Maybe there will be other exceptions, this solution
is ready for future enhancements.
2. Implementation of all exception constructors, but only one is used
Completeness.
3. Having no unittest for this
I have no time for adding one at the moment and I do not think
think it is really needed.
Please tell me what you think of this.