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

Hudson commented on TAP5-1963:
------------------------------

Integrated in tapestry-trunk-freestyle #977 (See 
[https://builds.apache.org/job/tapestry-trunk-freestyle/977/])
    TAP5-1963: Original exception lost in CommitAfterWorker upon abort 
(Revision 83e6d2edb1742977e72d084e9d750027c2f2c68d)

     Result = FAILURE
hlship : 
Files : 
* 
tapestry-hibernate/src/main/java/org/apache/tapestry5/internal/hibernate/CommitAfterWorker.java
* 
tapestry-jpa/src/main/java/org/apache/tapestry5/internal/jpa/CommitAfterMethodAdvice.java

                
> Original exception lost in CommitAfterWorker upon abort
> -------------------------------------------------------
>
>                 Key: TAP5-1963
>                 URL: https://issues.apache.org/jira/browse/TAP5-1963
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-hibernate
>    Affects Versions: 5.3.3
>            Reporter: Ben Dotte
>            Assignee: Howard M. Lewis Ship
>            Priority: Minor
>             Fix For: 5.3.4, 5.4
>
>
> advise() in CommitAfterWorker surrounds the method invocation and session 
> commit in a try/catch and runs manager.abort() if a RuntimeException is 
> caught and then rethrows the RuntimeException. The problem is, depending on 
> the original problem, it is not unlikely that manager.abort() itself could 
> throw an exception (Transaction Not Started, Transaction Already Started, 
> etc.). When that happens, the original RuntimeException is lost and all we 
> get is the useless exception generated by the call to manager.abort().
> I think we should just throw away any exceptions generated by manager.abort() 
> so that we always retain the original RuntimeException. Something like this:
> try
> {
>       invocation.proceed();
>       // Success or checked exception:
>       manager.commit();
> }
> catch (RuntimeException ex)
> {
>       try
>       {
>               manager.abort();
>       }
>       catch (Exception e)
>       {
>               // throw away; we want the real "ex" exception to get rethrown
>       }
>       throw ex;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to