db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Houx Zhang (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DERBY-4443) Wrap rollback in exception handlers in try-catch
Date Tue, 29 Mar 2011 15:13:09 GMT

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

Houx Zhang updated DERBY-4443:

    Attachment: DERBY-4443-5.patch

Thanks for your advice, Knut and Bryan. It's valuable for me to make progress.

I have recreated the error with Bryan's command. Here is why it's caused:

In the new test class 'RollBackWrappingWhenFailOnImportTest', a mock driver has been loaded,
but it has not been shut down any more. In setup() method of engine.ErrorStreamTest which
is closed in the completed test, a shutdownEngine() is called, it's used to shut down the
current engine. The shutdown operation invokes a call to MockInternalDriver.connect(), which
throw a mock connection(not valid here), so a SQLException of "Derby system shutdown" is thrown.

It's obvious that, 'RollBackWrappingWhenFailOnImportTest' has made a marginal influence on
other test cases, so in patch-5, I shut down the mock driver on tearDown(), -----the exception
can be ignored safely. Now, everything works well.

In patch-5, Knut's advices on printStackTrace() and vmSupportsJDBC3() are adopted. Thanks!

Please check the new patch-5!

> Wrap rollback in exception handlers in try-catch
> ------------------------------------------------
>                 Key: DERBY-4443
>                 URL: https://issues.apache.org/jira/browse/DERBY-4443
>             Project: Derby
>          Issue Type: Bug
>          Components: Demos/Scripts, Documentation, Eclipse Plug-in, JDBC, Network Client,
Network Server, Replication, Services, SQL, Test, Tools
>    Affects Versions:
>            Reporter: Aaron Digulla
>            Assignee: Houx Zhang
>              Labels: derby_triage10_8
>         Attachments: DERBY-4443-1.patch, DERBY-4443-2.patch, DERBY-4443-3.patch, DERBY-4443-4.patch,
DERBY-4443-4.png, DERBY-4443-5.patch, DERBY-4443.patch
> Avoid this pattern everywhere:
> 		}catch(SQLException se){
> 			//issue a rollback on any errors
> 			conn.rollback();
> 			throw  se;
> 		}
> because an error in rollback will shadow the original exception.

This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

View raw message