openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Curtis (JIRA)" <>
Subject [jira] [Commented] (OPENJPA-2340) [patch] UnsupportedOperationException on commit/rollback a transaction without writes
Date Mon, 18 Mar 2013 19:48:15 GMT


Rick Curtis commented on OPENJPA-2340:

What version of commons-collections are you running? In my env openjpa is running against
3.2.1 and IteratorChain.hasNext() doesn't throw an exception... it looks like earlier versions
> [patch] UnsupportedOperationException on commit/rollback a transaction without writes
> -------------------------------------------------------------------------------------
>                 Key: OPENJPA-2340
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.2.1
>            Reporter: Piotr Kubowicz
>            Assignee: Rick Curtis
>         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(
>         at org.apache.openjpa.kernel.LocalManagedRuntime.commit(
>         at org.apache.openjpa.kernel.BrokerImpl.commit(
>         at org.apache.openjpa.kernel.DelegatingBroker.commit(
>         at org.apache.openjpa.persistence.EntityManagerImpl.commit(
>         ... 37 more
> Caused by: java.lang.UnsupportedOperationException: IteratorChains must contain at least
one Iterator
>         at org.apache.commons.collections.iterators.IteratorChain.checkChainIntegrity(Unknown
>         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(
>         at org.apache.openjpa.kernel.BrokerImpl.afterCompletion(
>         ... 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
> - 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:

View raw message