[
https://issues.apache.org/jira/browse/DERBY-2472?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Knut Anders Hatlen updated DERBY-2472:
--------------------------------------
Attachment: seenext.stat
seenext.diff
The original patch (the one that was backed out) called initCause() on an
exception thrown from EmbedConnection.bootDatabase(). The attached patch tries
to achieve the same thing by passing the next SQLException to
EmbedSQLException's constructor (via a new utility method --
Util.seeNextException()), so that the chaining implemented by the previous
patches makes the next SQLException also the cause of the main exception,
without breaking the JDBC 4.0 driver. The patch also fixes the chaining of
exceptions in EmbedConnection.createDatabase(). Derbyall and suites.All passed
on Java 1.5 and Java 1.6.
Without the patch, the output from calling printStackTrace() on an exception
thrown when booting a database may look like this:
Exception in thread "main" java.sql.SQLException: Failed to start database
'/tmp/db', see the next exception for details.
(stack frames)
With the patch, the output looks like this:
Exception in thread "main" java.sql.SQLException: Failed to start database
'/tmp/db', see the next exception for details.
(stack frames)
Caused by: java.sql.SQLException: Unsupported upgrade from '10.2' to '10.3
beta'.
(stack frames)
Caused by: ERROR XCW00: Unsupported upgrade from '10.2' to '10.3 beta'.
(stack frames)
> 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, 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.