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] Commented: (DERBY-4443) Wrap rollback in exception handlers in try-catch
Date Sun, 20 Mar 2011 08:32:29 GMT

    [ https://issues.apache.org/jira/browse/DERBY-4443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13008891#comment-13008891
] 

Houx Zhang commented on DERBY-4443:
-----------------------------------

Oh, thanks, Bryan. Your advice is great! I will remember to give a patch before launch a discussion.

I have written some testing code before, just like I do in the new patch. In the patch, I
do "new MockInternalDriver();" in the setup() method of my junit test class, however, this
sentence will throw a exception as InternalDriver() will check its contextServiceFactory is
null.

I think the key point is to decide where to install the mock of InternalDriver to give it
a normal running circumstance, maybe it's related to some .

Comments are welcome.



> 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: 10.5.3.0
>            Reporter: Aaron Digulla
>              Labels: derby_triage10_8
>         Attachments: 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

Mime
View raw message