You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Aaron Digulla (JIRA)" <ji...@apache.org> on 2009/11/16 11:24:40 UTC

[jira] Created: (DERBY-4443) Wrap rollback in exception handlers in try-catch

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, Store, Test, Tools
    Affects Versions: 10.5.3.0
            Reporter: Aaron Digulla


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.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-4443) Wrap rollback in exception handlers in try-catch

Posted by "Aaron Digulla (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12778286#action_12778286 ] 

Aaron Digulla commented on DERBY-4443:
--------------------------------------

One place where I've seen this is SystemProcedures. Every method in there uses this anti-pattern.

Instead of calling rollback directly, a utility function should be defined which either ignores any exceptions in rollback or, preferred, prints/logs the exception.

> 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, Store, Test, Tools
>    Affects Versions: 10.5.3.0
>            Reporter: Aaron Digulla
>
> 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.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-4443) Wrap rollback in exception handlers in try-catch

Posted by "Mike Matrigali (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4443?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mike Matrigali updated DERBY-4443:
----------------------------------

    Component/s:     (was: Store)

removing store, as it does not have access to the connection or to SQLException.

> 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
>
> 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.
-
You can reply to this email to add a comment to the issue online.