Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Problem with CDOStore.contains()
[CDO] Problem with CDOStore.contains() [message #538982] Wed, 09 June 2010 09:10 Go to next message
Claes Rosell is currently offline Claes RosellFriend
Messages: 17
Registered: July 2009
Junior Member
Hi,

I am currently using CDO 3.0 20100526-1334 (Helios RC2) and I have run
into a problem that in the end leaves me with a DanglingReferenceException.


During a DeleteCommand a RemoveCommand is called to clean another Object
from references to the object to delete.
The RemoveCommand is doing an ownerList.containsAll(collection) call
from its prepare method which returns false, hence never executes.

It all boils down to an equals-call on AbstractCDOIDLong which tries to
compare a CDOObject (in TRANSIENT state) with a CDOID. Is it valid for a
feature-list of CDORevision to contain other things that CDOIDs?

This problem seems to exist for indexOf() and lastIndexOf() as well.

Best regards
/Claes

Stacktrace:

at
org.eclipse.emf.cdo.spi.common.id.AbstractCDOIDLong.equals(A bstractCDOIDLong.java:77)
at java.util.ArrayList.indexOf(ArrayList.java:216)
at java.util.ArrayList.contains(ArrayList.java:199)
at
org.eclipse.emf.cdo.spi.common.revision.BaseCDORevision.cont ains(BaseCDORevision.java:414)
at org.eclipse.emf.internal.cdo.CDOStore.contains(CDOStore.java :244)
at
org.eclipse.emf.ecore.impl.EStoreEObjectImpl$BasicEStoreELis t.delegateContains(EStoreEObjectImpl.java:227)
at
org.eclipse.emf.ecore.impl.EStoreEObjectImpl$BasicEStoreELis t.delegateContainsAll(EStoreEObjectImpl.java:235)
at
org.eclipse.emf.common.util.DelegatingEList.containsAll(Dele gatingEList.java:125)
at
org.eclipse.emf.edit.command.RemoveCommand.prepare(RemoveCom mand.java:248)
at
org.eclipse.emf.common.command.AbstractCommand.canExecute(Ab stractCommand.java:114)
at
org.eclipse.emf.edit.command.AbstractOverrideableCommand.doC anExecute(AbstractOverrideableCommand.java:120)
at
org.eclipse.emf.edit.command.AbstractOverrideableCommand.can Execute(AbstractOverrideableCommand.java:113)
at
org.eclipse.emf.common.command.CompoundCommand.appendAndExec ute(CompoundCommand.java:656)
Re: [CDO] Problem with CDOStore.contains() [message #538998 is a reply to message #538982] Wed, 09 June 2010 10:01 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Hi Claes,

I'm on the jump for a one day business trip so I may not have the time
now to fully investigate your problem. In the worst case I'll pick it up
on Friday. But see my comments below...


Am 09.06.2010 11:10, schrieb Claes Rosell:
> Hi,
>
> I am currently using CDO 3.0 20100526-1334 (Helios RC2) and I have run
> into a problem that in the end leaves me with a
> DanglingReferenceException.
>
>
> During a DeleteCommand a RemoveCommand is called to clean another
> Object from references to the object to delete.
> The RemoveCommand is doing an ownerList.containsAll(collection) call
> from its prepare method which returns false, hence never executes.
>
> It all boils down to an equals-call on AbstractCDOIDLong which tries
> to compare a CDOObject (in TRANSIENT state) with a CDOID. Is it valid
> for a feature-list of CDORevision to contain other things that CDOIDs?
Yes. But only while the object is in CDOState.NEW.

IIRC this may happen in scenarios where you create a refenrence from a
TRANSIENT object A to another TRANSIENT object B, then attach A but not
(yet) B. Object A will transition to NEW but can not "migrate" the
reference to B from an EObject to a CDOID. As an optimization during
attachment of B (so, generally during attachments) we keep the
"un-migrated" reference and fix it during commit.

I may be able to reproduce this in a test case on Friday. Can you please
file a bugzilla in the meantime?

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper


>
> This problem seems to exist for indexOf() and lastIndexOf() as well.
>
> Best regards
> /Claes
>
> Stacktrace:
>
> at
> org.eclipse.emf.cdo.spi.common.id.AbstractCDOIDLong.equals(A bstractCDOIDLong.java:77)
>
> at java.util.ArrayList.indexOf(ArrayList.java:216)
> at java.util.ArrayList.contains(ArrayList.java:199)
> at
> org.eclipse.emf.cdo.spi.common.revision.BaseCDORevision.cont ains(BaseCDORevision.java:414)
>
> at org.eclipse.emf.internal.cdo.CDOStore.contains(CDOStore.java :244)
> at
> org.eclipse.emf.ecore.impl.EStoreEObjectImpl$BasicEStoreELis t.delegateContains(EStoreEObjectImpl.java:227)
>
> at
> org.eclipse.emf.ecore.impl.EStoreEObjectImpl$BasicEStoreELis t.delegateContainsAll(EStoreEObjectImpl.java:235)
>
> at
> org.eclipse.emf.common.util.DelegatingEList.containsAll(Dele gatingEList.java:125)
>
> at
> org.eclipse.emf.edit.command.RemoveCommand.prepare(RemoveCom mand.java:248)
>
> at
> org.eclipse.emf.common.command.AbstractCommand.canExecute(Ab stractCommand.java:114)
>
> at
> org.eclipse.emf.edit.command.AbstractOverrideableCommand.doC anExecute(AbstractOverrideableCommand.java:120)
>
> at
> org.eclipse.emf.edit.command.AbstractOverrideableCommand.can Execute(AbstractOverrideableCommand.java:113)
>
> at
> org.eclipse.emf.common.command.CompoundCommand.appendAndExec ute(CompoundCommand.java:656)
>


Previous Topic:Internal structure of java method
Next Topic:EMF Compare : contentType for .xml extension
Goto Forum:
  


Current Time: Tue Apr 23 11:17:31 GMT 2024

Powered by FUDForum. Page generated in 0.03005 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top