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 Mon, 04 Apr 2011 14:04:06 GMT

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

Bryan Pendleton commented on DERBY-4443:

Would it help if we made rollBackAndThrowSQLException throw 
something other than a SQLException when it caught a rollback() exception?

For example, would it help if that catch() block threw a StandardException instead?

I guess I'm not quite sure I understand what rule StandardException is
enforcing. Is it OK for a StandardException to wrap a StandardException, but
if a SQLException wraps a StandardException than it gets automatically unwrapped?

I suspect this has to do with improving the external user experience for the
caller; particularly in client/server scenarios the exceptions that travel from
server to client tend to get wrapped along the way with uninteresting and not-so-useful
outer exceptions, and so perhaps this code is trying to undo that and get
more quickly to the underlying exception since it is more likely to reveal the real problem.

> 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