Thread: bug in new StatementHandler

bug in new StatementHandler

From
Mike Beachy
Date:
There's a problem in how exceptions are handled (or rather, not handled)
in the new StatementHandler. If an SQLException is thrown in one of the
Statement methods, java.lang.reflect.Method catches it and throws it as
an InvocationTargetException. The handler needs to catch this and
extract the underlying exception.

A test for this problem and a patch are attached.

The same problem seems to exist for the ConnectionHandler, so I
implemented the code there as well. Aaron, if you could double check
what I've done that'd be cool.

Thanks.

Mike

Attachment

Re: bug in new StatementHandler

From
Aaron Mulder
Date:
    The patch to fix the bug looks good.

    The patch for the test could be improved.  Instead of letting the
InvocationTargetException fall through, can you revise the test patch to
catch Exception after it catches SQLException with a failure message like
"wrong type of exception thrown; expecting SQLException not "+
e.getClass().getName() or something along those lines?

Thanks,
    Aaron

On Thu, 12 Dec 2002, Mike Beachy wrote:
> There's a problem in how exceptions are handled (or rather, not handled)
> in the new StatementHandler. If an SQLException is thrown in one of the
> Statement methods, java.lang.reflect.Method catches it and throws it as
> an InvocationTargetException. The handler needs to catch this and
> extract the underlying exception.
>
> A test for this problem and a patch are attached.
>
> The same problem seems to exist for the ConnectionHandler, so I
> implemented the code there as well. Aaron, if you could double check
> what I've done that'd be cool.
>
> Thanks.
>
> Mike
>


Re: bug in new StatementHandler

From
Mike Beachy
Date:
On Thu, Dec 12, 2002 at 02:06:05PM -0500, Aaron Mulder wrote:
>     The patch for the test could be improved.

Fair enough. Patch with improved test is attached.

Mike

Attachment

test message.

From
Nic Ferrier
Date:
I'm having trouble sending my cursor-based-resultset patch to the
list. This is a test message to see if it's rejecting me for some
reason.

Sorry if this annoys anyone.


Nic

Re: test message.

From
Kris Jurka
Date:
On 12 Dec 2002, Nic Ferrier wrote:

> I'm having trouble sending my cursor-based-resultset patch to the
> list. This is a test message to see if it's rejecting me for some
> reason.
>

There is a maximum message size limit for this list.  I don't know what it
is, but that might be the problem.  You might try posting it to patches
(which has a higher limit) and just send a message to this list indicating
that you have done so.

Kris Jurka



Re: bug in new StatementHandler

From
Dave Cramer
Date:
Patch applied,

thanks!
On Thu, 2002-12-12 at 14:57, Mike Beachy wrote:
> On Thu, Dec 12, 2002 at 02:06:05PM -0500, Aaron Mulder wrote:
> >     The patch for the test could be improved.
>
> Fair enough. Patch with improved test is attached.
>
> Mike
>
> ______________________________________________________________________
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
--
Dave Cramer <Dave@micro-automation.net>