Andrus Adamchik created CAY-2110:
------------------------------------

             Summary: Obfuscated execption when processing iterated results
                 Key: CAY-2110
                 URL: https://issues.apache.org/jira/browse/CAY-2110
             Project: Cayenne
          Issue Type: Bug
    Affects Versions: 4.0.M3
            Reporter: Andrus Adamchik
            Assignee: Andrus Adamchik
            Priority: Minor


This was reported by a user. I don't have a full test case yet, but I think we 
can easily build it. Iterated query throws the following exception:

org.apache.cayenne.CayenneRuntimeException: [v.4.0.M4.4937cd0 May 25 2016 
12:27:14] java.lang.IllegalStateException: Transaction must have 
'STATUS_ACTIVE' to be committed. Current status: STATUS_MARKED_ROLLEDBACK
        at 
org.apache.cayenne.access.TransactionResultIteratorDecorator.close(TransactionResultIteratorDecorator.java:67)
...
Caused by: java.lang.IllegalStateException: Transaction must have 
'STATUS_ACTIVE' to be committed. Current status: STATUS_MARKED_ROLLEDBACK
        at 
org.apache.cayenne.tx.BaseTransaction.commit(BaseTransaction.java:126)
        at 
org.apache.cayenne.access.TransactionResultIteratorDecorator.close(TransactionResultIteratorDecorator.java:60)
        ... 12 more

What seems to happen is an uncaught exception during iteration, and a call to 
"close" in the "finally" method of the iterator attempts to commit transaction 
that is already in the ROLLBACK state. Looks like we need to check transaction 
state inside 'TransactionResultIteratorDecorator.close()' before committing... 
If it is not ready to be committed, it should be rolled back.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to