[ 
https://issues.apache.org/jira/browse/DERBY-2472?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Knut Anders Hatlen updated DERBY-2472:
--------------------------------------

    Attachment: initCause2.stat
                initCause2.diff

I have changed my mind again about how to handle the unsafe calls to 
initCause(). The comments in the code indicate that the complexity was added 
deliberately and I do see the value of getting all the errors for instance if 
you try to drop a table and there are many dependent objects. Therefore, I 
suggest that we keep the current behaviour when we can, and if initCause() 
throws IllegalStateException, we skip the exception we could not put into the 
chain. This is a very simple change, it doesn't require any test changes like 
the previous suggestion did, and it guarantees that the first exception caught 
is always part of the exception chain. initCause2.diff implements the suggested 
solution. All tests passed.

> Use Throwable.initCause() to improve error reporting
> ----------------------------------------------------
>
>                 Key: DERBY-2472
>                 URL: https://issues.apache.org/jira/browse/DERBY-2472
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC, Miscellaneous
>    Affects Versions: 10.3.0.0
>            Reporter: Kristian Waagan
>         Assigned To: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: derby-2472_initial_patch.diff, embedsqlexception.diff, 
> embedsqlexception.stat, initCause.diff, initCause.stat, initCause2.diff, 
> initCause2.stat, seenext.diff, seenext.stat, setStackTrace-v2.diff, 
> setStackTrace.diff, standardexception.diff, standardexception.stat
>
>
> As Derby has moved to J2SE 1.4, Throwable.initCause() can now be used to 
> improve error reporting.
> As stated in the initial commit (that was backed out, see below):
> 'Set Throwable.initCause() in a couple of locations at the JDBC level where 
> we setup nested SQLExceptions.
> This means that automatically the stack trace for a database failed to start 
> includes the reason
> for the failure, rather than just "see next exception". This is a great help 
> when running
> JUnit tests and getting failures to start a database.'
> The initial commit was backed out because it broke numerous tests under JDK 
> 1.6, and the author indicated he had no time to investigate.
> The patch caused no failures when running the tests with Java SE 5.0.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to