Unwrap InvocationTargetException from underlying statement execution#744
Conversation
When executing a wrapped statement, any resulting SQLException is wrapped in an InvocationTargetException by the reflective invocation, which is rethrown by the InvocationHandler as an UndeclaredThrowableException. To ensure the expected SQLException is thrown, the invocation of the wrapped object is being moved into the existing try-catch block, thereby ensuring the InvocationTargetException is unwrapped and the underlying exception thrown by the handler.
|
Hello @markt-asf, is there any possible chance of having pre-release snapshot with this change to validate it or we should wait for official build ? |
|
There will be one in the snapshot repo in about 40 mins once the CI system finishes testing it. (There is a snapshot build after ~every commit). |
|
It isn't an official release. It is for testing purposes only. Use it at your own risk. If your server catches fire don't blame us ;) |
|
Of course, thanks a lot! |
|
I just wanted to point out that we had a similar issue to VRBogdanov where upgrading to 9.0.93 from 9.0.91, starting throwing Upgrading to the 9.0.94-dev (Snapshot) release confirmed that the changes here fixed the issue. So we will wait for 9.0.94 to be released before upgrading. Thanks all. |
When executing a wrapped statement, any resulting SQLException is wrapped in an InvocationTargetException by the reflective invocation, which is rethrown by the InvocationHandler as an
UndeclaredThrowableException. To ensure the expected SQLException is thrown, the invocation of the wrapped object is being moved into the existing try-catch block, thereby ensuring the InvocationTargetException is unwrapped and the underlying exception thrown by the handler.
https://bz.apache.org/bugzilla/show_bug.cgi?id=69255