db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-4443) Wrap rollback in exception handlers in try-catch
Date Sat, 19 Mar 2011 15:54:29 GMT

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

Bryan Pendleton commented on DERBY-4443:
----------------------------------------

Often I find that the best way to move forward with a problem is to try writing the code that
you think you want to write (in this case, a class that would sub-class InternalDriver, perhaps
named MockInternalDriver), try
placing a call to
    InternalDriver myDriver = new MockInternalDriver();
somewhere in the setUp() method of ImportExportProcedureTest, try it out, and
see what happens.

You can probably put the MockInternalDriver code directly into ImportExportProcedureTest,
as a nested class, so you don't have to create any new source files to do this.

Put some System.out.println statements into your mock class, so you can see
whether it is getting run or not, and where it is being used.

It probably won't work. But, then you can attach an updated patch, containing the
actual code that you tried, and describe what it did and what you wanted it to do instead.

In essence: try writing some code, see how far you get, atttach the code you tried, and
a description of where exactly you got stuck, and the community will offer some
suggestions about what to try next.


> 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