[jbpm-issues] [JBoss JIRA] Commented: (JBPM-1465) NullPointerException on transaction.rollback() in DbPersistenceService

Alejandro Guizar (JIRA) jira-events at lists.jboss.org
Tue Aug 19 19:18:22 EDT 2008


    [ https://jira.jboss.org/jira/browse/JBPM-1465?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12425777#action_12425777 ] 

Alejandro Guizar commented on JBPM-1465:
----------------------------------------

After examining the close() operation and its support methods, I concluded the rollback() call should not be made when a flushException occurs.

If (isTransactionEnabled && transaction!= null) is true, then the transaction has been either committed or rolled back already by the time flushSession() is invoked, hence rollback() is redundant and possibly dangerous.

Conversely, if (isTransactionEnabled && transaction!= null) is false, then there is no transaction to roll back.

I am adding a flush exception test to the PersistenceDbServiceNoTxTest case.

> NullPointerException on transaction.rollback() in DbPersistenceService
> ----------------------------------------------------------------------
>
>                 Key: JBPM-1465
>                 URL: https://jira.jboss.org/jira/browse/JBPM-1465
>             Project: JBoss jBPM
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: SOA 4.2 CP02, jPDL 3.2.3
>            Reporter: Martin Putz
>            Assignee: Alejandro Guizar
>
> We are having NullPointerException from DbPersistenceService when Hibernate throws Exception on close() method. The line is transaction.rollback(); in rollback() method. My two cents is this code should be embraced with "if ( isTransactionEnabled && (transaction != null) )" statement, because we are using external JDBC Connection provider, and the transaction reference never be set.
> All calls to the rollback() method in DbPersistenceService are already preceded by a check for
>    if ( (isTransactionEnabled)
>         && (transaction!=null)
>       ) {
> except this one after an exception has happened during the Hibernate session.flush call:
>     Exception flushException = flushSession();
>     if (flushException!=null) {
>       rollback();                         // missing check if there is a transaction 
>       closeSession();
>       closeConnection();
>       throw new JbpmPersistenceException("hibernate flush failed", flushException);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jbpm-issues mailing list