openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey (JIRA)" <j...@apache.org>
Subject [jira] Updated: (OPENJPA-261) UnsupportedOperationException occurred in BrokerImpl.java
Date Wed, 20 Jun 2007 05:53:25 GMT

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

Patrick Linskey updated OPENJPA-261:
------------------------------------

    Attachment: OPENJPA-261-Java5.jar
                OPENJPA-261.patch

So I saw exactly this problem a few days ago, and fixed the code that was leading to the IteratorChain
problem. Upon doing so, I just ended up uncovering a new problem.

Attached is a patch that gets past this exception; I expect that you will just get a new exception,
probably about the managed cache being corrupt. Can you try it out?

The jar contains a a compiled version of the patch; because of some other changes that I'm
working on in my environment, the jar has a dependency on Java 5; if you are still using JDK1.4,
you'll need to manually apply the patch (or convince another OpenJPA developer to do so, and
post the jar). If you are using Java 5, just put the jar in the front of your classpath, or
update the contents of openjpa.jar with the classes listed in the jar.

Also, can you describe what your test case is doing, or better yet, attach your test case
to this issue?

> UnsupportedOperationException occurred in BrokerImpl.java
> ---------------------------------------------------------
>
>                 Key: OPENJPA-261
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-261
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 0.9.7
>         Environment: Window XP
>            Reporter: Teresa Kan
>            Priority: Critical
>         Attachments: NPE.patch, OPENJPA-261-Java5.jar, OPENJPA-261.patch
>
>
> While I was testing against the openjpa code, I got an UnsupportedOperationException
in the BrokerImpl.endtransaction() method. The method set the transState to an empty Collection
if there is no cache for transactions. Later the code got an UnsupportedOperationException.
> Original code:
> Collection transStates = _transCache;
>         if (transStates == null)
>             transStates = Collections.EMPTY_LIST;
> .....
> for (Iterator itr = transStates.iterator(); itr.hasNext();) {
>             sm = (StateManagerImpl) itr.next();
>             try {
>                 if (rollback) {
>                     // tell objects that may have been derefed then flushed
>                     // (and therefore deleted) to un-deref
>                     sm.setDereferencedDependent(false, false);
>                     sm.rollback();
>                 } else
>                     sm.commit();
>             } catch (RuntimeException re) {
>                 exceps = add(exceps, re);
>             }
>          }
> I put a check before this "for" loop then the UnsupportedOperationException
> disappeared.
> if (!transStates.isEmpty()) {   
>         	for (Iterator itr = transStates.iterator(); itr.hasNext();) {
>             sm = (StateManagerImpl) itr.next();
>             try {
>                 if (rollback) {
>                     // tell objects that may have been derefed then flushed
>                     // (and therefore deleted) to un-deref
>                     sm.setDereferencedDependent(false, false);
>                     sm.rollback();
>                 } else
>                     sm.commit();
>             } catch (RuntimeException re) {
>                 exceps = add(exceps, re);
>             }
>          }
>         }
> The NPE.patch is attached to this JIRA. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message