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

Houx Zhang edited comment on DERBY-4443 at 3/6/11 5:37 AM:
-----------------------------------------------------------

I think it's a good point for a new comer. I have provided a patch. In my 
patch, a method named rollBackWhenSQLExceptionOccurs() is added. I'm not sure 
there is any other place to use this method , if so, it's better to add this 
method in an independent util class.

Please check it and give some advice, thanks!

      was (Author: houxzhang):
    I think it's a good point for a new comer. I have providing a patch. In my 
patch, a method named rollBackWhenSQLExceptionOccurs() is added. I'm not sure 
there is any other place to use this function, if so, it's better to add this 
method in a independent util class.

Please check it and give some advice, thanks!
  
> 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

        

Reply via email to