openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Piotr Kubowicz (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (OPENJPA-2340) UnsupportedOperationException on commit/rollback a transaction without writes
Date Wed, 27 Feb 2013 10:03:13 GMT

     [ https://issues.apache.org/jira/browse/OPENJPA-2340?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Piotr Kubowicz updated OPENJPA-2340:
------------------------------------

    Attachment: BrokerImpl-trans-cache.patch
    
> UnsupportedOperationException on commit/rollback a transaction without writes
> -----------------------------------------------------------------------------
>
>                 Key: OPENJPA-2340
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2340
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.2.1
>            Reporter: Piotr Kubowicz
>         Attachments: BrokerImpl-trans-cache.patch
>
>
> I met the following exception:
> Caused by: <openjpa-2.2.1-r422266:1396819 nonfatal general error> org.apache.openjpa.persistence.PersistenceException:
IteratorChains must contain at least one Iterator
>         at org.apache.openjpa.kernel.BrokerImpl.afterCompletion(BrokerImpl.java:2036)
>         at org.apache.openjpa.kernel.LocalManagedRuntime.commit(LocalManagedRuntime.java:94)
>         at org.apache.openjpa.kernel.BrokerImpl.commit(BrokerImpl.java:1516)
>         at org.apache.openjpa.kernel.DelegatingBroker.commit(DelegatingBroker.java:933)
>         at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:570)
>         ... 37 more
> Caused by: java.lang.UnsupportedOperationException: IteratorChains must contain at least
one Iterator
>         at org.apache.commons.collections.iterators.IteratorChain.checkChainIntegrity(Unknown
Source)
>         at org.apache.commons.collections.iterators.IteratorChain.lockChain(Unknown Source)
>         at org.apache.commons.collections.iterators.IteratorChain.hasNext(Unknown Source)
>         at org.apache.openjpa.kernel.BrokerImpl.endTransaction(BrokerImpl.java:2407)
>         at org.apache.openjpa.kernel.BrokerImpl.afterCompletion(BrokerImpl.java:2012)
>         ... 41 more
> It's hard for me to provide a minimal reproduction steps. Generally what I am doing is:
> manager.getTransaction().begin();
> // save some entities joined in a complex way
> manager.getTransaction().commit(); // fine
> manager.clear();
> manager.getTransaction().begin();
> manager.getTransaction().rollback(); // throws exception
> What is funny, I have an @After method in my test that does another:
> manager.getTransaction().rollback();
> and it succeeds.
> After some debugging I found that the bug is in how BrokerImpl.endTransaction() initializes
transStates:
> - in the rollback that throws exceptions, hasTransactionalObjects() returns true, although
_transCache.size() returns 0; iterator returned by the empty _transCache throws UnsupportedOperationException
> - in the rollback in @After, hasTransactionalObjects() returns false, transStates is
initialized with Collections.EMPTY_SET and there is no problem with the iterator
> I attached a patch which makes hasTransactionalObjects() check not only if _transCache
is null, but also if its empty.

--
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

Mime
View raw message