db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] Closed: (DERBY-1991) Misleading stack traces for exceptions raised by the JDBC 4.0 embedded driver
Date Tue, 31 Oct 2006 08:51:12 GMT
     [ http://issues.apache.org/jira/browse/DERBY-1991?page=all ]

Knut Anders Hatlen closed DERBY-1991.
-------------------------------------

    Fix Version/s: 10.2.1.8
                   10.3.0.0
       Resolution: Fixed
       Derby Info:   (was: [Patch Available])

Committed to trunk with revision 469410.
Committed to 10.2 with revision 469415.

> Misleading stack traces for exceptions raised by the JDBC 4.0 embedded driver
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-1991
>                 URL: http://issues.apache.org/jira/browse/DERBY-1991
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.2.1.6
>         Environment: Java SE 6, Derby with JDBC 4.0 compiled in.
>            Reporter: Knut Anders Hatlen
>         Assigned To: Knut Anders Hatlen
>            Priority: Minor
>             Fix For: 10.2.1.8, 10.3.0.0
>
>         Attachments: derby-1991.diff, derby-1991.stat
>
>
> When the embedded driver raises an SQLException, its stack trace always
> says it is created in SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA().
> This is not correct.
> At some point, SQLExceptionFactory40.getSQLException() set the stack trace
> of the SQLException to the stack trace of the non-SQLException that caused
> it, if there were one. This was probably done to mimic the behaviour of
> EmbedSQLException, which overrides printStackTrace() to achieve the
> same. Later, code was added to ferry arguments over DRDA. This code created
> a dummy exception which the old code interpreted as a non-SQLException
> whose stack trace should be used for the main exception. Therefore, all
> exceptions now have the same stack trace as the dummy exception created in
> wrapArgsForTransportAcrossDRDA().
> I think the best solution is not to set the stack trace explicitly, not
> even when the SQLException is caused by a non-SQLException.
> EmbedSQLException overrides printStackTrace() because throwables in Java
> 1.3 didn't have initCause()/getCause(), so it was the only way to preserve
> the original stack trace. Since the SQLExceptions in JDBC 4.0 have
> initCause()/getCause(), there is no reason why the JDBC4 driver should
> mimic EmbedSQLException's workaround for not having these methods.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message