Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] dangling reference on deleted object.
[CDO] dangling reference on deleted object. [message #740205] Tue, 18 October 2011 09:02 Go to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Hi there,

In this scenario:

Object A in CDOresourceA /repo/a/nameof_a
Object B in CDOresourceB /repo/all_b_objects


B has a reference to A and A has a reference to B (with an EOpposite).

When I want to save the deleted A, I get a dangling reference exception,
even tough I delete the reference from B to A. and I delete A.

My questions: Is the order of deletion relevant? (First the object and
then the reference?) or could I get this exception because I should also
delete the opposite (From A to B) even though A is actually deleted
implicitly deleting the reference A->B.

finally, could it be that CDOresourceB should be saved explicitly?
(Object B is found through an queryXRefs, and I don't have the
CDOresource in my resource set, my saving mechanism only saves objects
which have a CDOResource contained in a resourceset, so it walks the set
and saves the resources in it).


here is the exception:

Caused by: org.eclipse.emf.cdo.util.DanglingReferenceException: The
object
"NetXResource?(com.netxforge.netxstudio.library.impl.NetXResourceImpl)"
is not contained in a resource
at
org.eclipse.emf.internal.cdo.view.AbstractCDOView.provideCDOID(AbstractCDOView.java:900)
at
org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.provideCDOID(CDOTransactionImpl.java:2027)
at
org.eclipse.emf.cdo.internal.common.revision.delta.CDOSingleValueFeatureDeltaImpl.writeValue(CDOSingleValueFeatureDeltaImpl.java:86)
at
org.eclipse.emf.cdo.internal.common.revision.delta.CDOSingleValueFeatureDeltaImpl.write(CDOSingleValueFeatureDeltaImpl.java:62)
at
org.eclipse.emf.cdo.internal.common.protocol.CDODataOutputImpl.writeCDOFeatureDelta(CDODataOutputImpl.java:388)
at
org.eclipse.emf.cdo.internal.common.revision.delta.CDOListFeatureDeltaImpl.write(CDOListFeatureDeltaImpl.java:136)

thank you, Christophe
Re: [CDO] dangling reference on deleted object. [message #740231 is a reply to message #740205] Tue, 18 October 2011 09:40 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Hi Christophe,

Comments below...


Am 18.10.2011 11:02, schrieb Christophe Bouhier:
> Hi there,
>
> In this scenario:
>
> Object A in CDOresourceA /repo/a/nameof_a
> Object B in CDOresourceB /repo/all_b_objects
>
>
> B has a reference to A and A has a reference to B (with an EOpposite).
>
> When I want to save the deleted A, I get a dangling reference exception, even tough I delete the reference from B to
> A. and I delete A.
Just by removing one end of a bidi reference from its container does not "cut" the bidi reference on any end. Bidi
(EOpposite) only means that, if you unset one end, the other end is automatically unset. The DanglingReferenceException
correctly reminds you to either unset the cross reference (on either end if it's bidi) or attach the ref target to a
resource of your choice.

>
> My questions: Is the order of deletion relevant? (First the object and then the reference?) or could I get this
> exception because I should also delete the opposite (From A to B) even though A is actually deleted implicitly
> deleting the reference A->B.
The more I read the more I get confused :P

The reference you're talking about, is it a containment reference? I recommend not to use the term "delete" at all,
neither in Java nor in EMF you can actually delete objects. In EMF you can detach objects by removing them from their
container feature (which leads to deletion when you commit later and haven't attached elsewhere).

BTW. a little test method says more than thousand words. In addition you'll get a fix way quicker if your test method
reproduces a bug in CDO. We have a cool end to end test framework where you can fully focus on the particular client
logic you want to test. Please let me know if yu need help with it ;-)

>
> finally, could it be that CDOresourceB should be saved explicitly?
With CDO you can't save specific resources, you can only commit all the changes to an entire resourceset (exception to
this rule: partial commits, since 4.0).

> (Object B is found through an queryXRefs, and I don't have the CDOresource in my resource set, my saving mechanism
> only saves objects which have a CDOResource contained in a resourceset, so it walks the set and saves the resources in
> it).
The save() method of CDOResourceImpl just delegates to commit() of the associated CDOTransaction.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


>
>
> here is the exception:
>
> Caused by: org.eclipse.emf.cdo.util.DanglingReferenceException: The object
> "NetXResource?(com.netxforge.netxstudio.library.impl.NetXResourceImpl)" is not contained in a resource
> at org.eclipse.emf.internal.cdo.view.AbstractCDOView.provideCDOID(AbstractCDOView.java:900)
> at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.provideCDOID(CDOTransactionImpl.java:2027)
> at
> org.eclipse.emf.cdo.internal.common.revision.delta.CDOSingleValueFeatureDeltaImpl.writeValue(CDOSingleValueFeatureDeltaImpl.java:86)
> at
> org.eclipse.emf.cdo.internal.common.revision.delta.CDOSingleValueFeatureDeltaImpl.write(CDOSingleValueFeatureDeltaImpl.java:62)
> at org.eclipse.emf.cdo.internal.common.protocol.CDODataOutputImpl.writeCDOFeatureDelta(CDODataOutputImpl.java:388)
> at org.eclipse.emf.cdo.internal.common.revision.delta.CDOListFeatureDeltaImpl.write(CDOListFeatureDeltaImpl.java:136)
>
> thank you, Christophe
>
>
>
>


Re: [CDO] dangling reference on deleted object. [message #740254 is a reply to message #740231] Tue, 18 October 2011 10:06 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Hi Eike,

Thank you sofar, See my response below.

On 18-10-11 11:40, Eike Stepper wrote:
> Hi Christophe,
>
> Comments below...
>
>
> Am 18.10.2011 11:02, schrieb Christophe Bouhier:
>> Hi there,
>>
>> In this scenario:
>>
>> Object A in CDOresourceA /repo/a/nameof_a
>> Object B in CDOresourceB /repo/all_b_objects
>>
>>
>> B has a reference to A and A has a reference to B (with an EOpposite).
>>
>> When I want to save the deleted A, I get a dangling reference
>> exception, even tough I delete the reference from B to A. and I delete A.
> Just by removing one end of a bidi reference from its container does not
> "cut" the bidi reference on any end.
Yes, I am aware of this, therefor I unset B -> A cross reference first.

Bidi (EOpposite) only means that,
> if you unset one end, the other end is automatically unset. The
> DanglingReferenceException correctly reminds you to either unset the
> cross reference (on either end if it's bidi) or attach the ref target to
> a resource of your choice.
>

>>
>> My questions: Is the order of deletion relevant? (First the object and
>> then the reference?) or could I get this exception because I should
>> also delete the opposite (From A to B) even though A is actually
>> deleted implicitly deleting the reference A->B.
> The more I read the more I get confused :P
Yes, I kind of trade in confusion these days :) Apologies, this is tough
for me as well...

>
> The reference you're talking about, is it a containment reference?
No it's a cross-ref.

I
> recommend not to use the term "delete" at all, neither in Java nor in
> EMF you can actually delete objects. In EMF you can detach objects by
> removing them from their container feature (which leads to deletion when
> you commit later and haven't attached elsewhere).
>
The term delete and remove is used by the emf.edit command framework
which I use a lot, so hence my usage of these terms. I do understand,
what you mean,however so for this case we remove A from it's container.
When committing CDOResourceA?


> BTW. a little test method says more than thousand words. In addition
> you'll get a fix way quicker if your test method reproduces a bug in
> CDO. We have a cool end to end test framework where you can fully focus
> on the particular client logic you want to test. Please let me know if
> yu need help with it ;-)
>
Yes, thank you for reminding me. I do not suspect a bug in CDO, but
simply my malusage of CDO :)

>>
>> finally, could it be that CDOresourceB should be saved explicitly?
> With CDO you can't save specific resources, you can only commit all the
> changes to an entire resourceset (exception to this rule: partial
> commits, since 4.0).
>
>> (Object B is found through an queryXRefs, and I don't have the
>> CDOresource in my resource set, my saving mechanism only saves objects
>> which have a CDOResource contained in a resourceset, so it walks the
>> set and saves the resources in it).
> The save() method of CDOResourceImpl just delegates to commit() of the
> associated CDOTransaction.
>
Yes I am aware. so does CDO automaticly commit object B, which is not in
the resource set? (Or does it resolve B and add the CDOResource
containing B to the resource set automaticly, when using queryXRefs? ).

> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>>
>>
>> here is the exception:
>>
>> Caused by: org.eclipse.emf.cdo.util.DanglingReferenceException: The
>> object
>> "NetXResource?(com.netxforge.netxstudio.library.impl.NetXResourceImpl)" is
>> not contained in a resource
>> at
>> org.eclipse.emf.internal.cdo.view.AbstractCDOView.provideCDOID(AbstractCDOView.java:900)
>>
>> at
>> org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.provideCDOID(CDOTransactionImpl.java:2027)
>>
>> at
>> org.eclipse.emf.cdo.internal.common.revision.delta.CDOSingleValueFeatureDeltaImpl.writeValue(CDOSingleValueFeatureDeltaImpl.java:86)
>>
>> at
>> org.eclipse.emf.cdo.internal.common.revision.delta.CDOSingleValueFeatureDeltaImpl.write(CDOSingleValueFeatureDeltaImpl.java:62)
>>
>> at
>> org.eclipse.emf.cdo.internal.common.protocol.CDODataOutputImpl.writeCDOFeatureDelta(CDODataOutputImpl.java:388)
>>
>> at
>> org.eclipse.emf.cdo.internal.common.revision.delta.CDOListFeatureDeltaImpl.write(CDOListFeatureDeltaImpl.java:136)
>>
>>
>> thank you, Christophe
>>
>>
>>
>>
Re: [CDO] dangling reference on deleted object. [message #740521 is a reply to message #740254] Tue, 18 October 2011 15:47 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Am 18.10.2011 12:06, schrieb Christophe Bouhier:
<blockquote cite="mid:j7jicf$6ju$1@news.eclipse.org" type="cite">The
save() method of CDOResourceImpl just delegates to commit() of the
<br>
Yes I am aware. so does CDO automaticly commit object B, which is
not in the resource set? </blockquote>
CDO internally remembers DIRTY objects in a number of data
structures that do not necessarily require the containing resource
be loaded.<br>
<br>
<blockquote cite="mid:j7jicf$6ju$1@news.eclipse.org" type="cite">(Or
does it resolve B and add the CDOResource containing B to the
resource set automaticly, when using queryXRefs? ).
<br>
</blockquote>
That's also possible. Honestly, I do not remember this particular
detail without stepping through it, because this has changed once or
twice over a 7 years time. A concrete test method would be a nice
basis for further discussion and analysis. I've just added a diagram
for our main test model. Maybe that helps to reproduce your
scenario:<br>
<br>
<img src="http://www.eclipse.org/forums/index.php?t=getfile&amp;id=4410" alt=""><br>
Almost 1500 test cases already exist and serve as examples ;-)<br>
<br>
Cheers<br>
/Eike<br>
<br>
----<br>
<a class="moz-txt-link-freetext" href="http://www.esc-net.de">http://www.esc-net.de</a><br>
<a class="moz-txt-link-freetext" href="http://thegordian.blogspot.com">http://thegordian.blogspot.com</a><br>
<a class="moz-txt-link-freetext" href="http://twitter.com/eikestepper">http://twitter.com/eikestepper</a><br>
<br>
<br>
<blockquote cite="mid:j7jicf$6ju$1@news.eclipse.org" type="cite">
<br>
<blockquote type="cite">Cheers
<br>
/Eike
<br>
<br>
----
<br>
<a class="moz-txt-link-freetext" href="http://www.esc-net.de">http://www.esc-net.de</a>
<br>
<a class="moz-txt-link-freetext" href="http://thegordian.blogspot.com">http://thegordian.blogspot.com</a>
<br>
<a class="moz-txt-link-freetext" href="http://twitter.com/eikestepper">http://twitter.com/eikestepper</a>
<br>
<br>
<br>
<blockquote type="cite">
<br>
<br>
here is the exception:
<br>
<br>
Caused by:
org.eclipse.emf.cdo.util.DanglingReferenceException: The
<br>
object
<br>
"NetXResource?(com.netxforge.netxstudio.library.impl.NetXResourceImpl)"
is
<br>
not contained in a resource
<br>
at
<br>
org.eclipse.emf.internal.cdo.view.AbstractCDOView.provideCDOID(AbstractCDOView.java:900)
<br>
<br>
at
<br>
org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.provideCDOID(CDOTransactionImpl.java:2027)
<br>
<br>
at
<br>
org.eclipse.emf.cdo.internal.common.revision.delta.CDOSingleValueFeatureDeltaImpl.writeValue(CDOSingleValueFeatureDeltaImpl.java:86)
<br>
<br>
at
<br>
org.eclipse.emf.cdo.internal.common.revision.delta.CDOSingleValueFeatureDeltaImpl.write(CDOSingleValueFeatureDeltaImpl.java:62)
<br>
<br>
at
<br>
org.eclipse.emf.cdo.internal.common.protocol.CDODataOutputImpl.writeCDOFeatureDelta(CDODataOutputImpl.java:388)
<br>
<br>
at
<br>
org.eclipse.emf.cdo.internal.common.revision.delta.CDOListFeatureDeltaImpl.write(CDOListFeatureDeltaImpl.java:136)
<br>
<br>
<br>
thank you, Christophe
<br>
<br>
<br>
<br>
<br>
</blockquote>
</blockquote>
<br>
</blockquote>
</body>
</html>
  • Attachment: bibgahcg.png
    (Size: 27.73KB, Downloaded 162 times)


Re: [CDO] dangling reference on deleted object. [message #741089 is a reply to message #740254] Wed, 19 October 2011 07:08 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Eike,

I found the problem. The RemoveCommand for the Reference B->A was not
"executable".

RemoveCommand.create(domain, referencingEObject,
eStructuralFeature, eObject)

I have tried a similar case which is not a bidi reference (No
EOpposite), and then the remove command works as expected.

rgds Christophe
Re: [CDO] dangling reference on deleted object. [message #741205 is a reply to message #741089] Wed, 19 October 2011 09:35 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 19.10.2011 09:08, schrieb Christophe Bouhier:
> Eike,
>
> I found the problem. The RemoveCommand for the Reference B->A was not "executable".
>
> RemoveCommand.create(domain, referencingEObject,
> eStructuralFeature, eObject)
>
> I have tried a similar case which is not a bidi reference (No EOpposite), and then the remove command works as expected.
I'm not very experienced with the edit framework because CDO mostly operates on the model level. Does that mean your
problem is either solved or not CDO-related?

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: [CDO] dangling reference on deleted object. [message #741237 is a reply to message #741205] Wed, 19 October 2011 10:20 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Hi Eike,

I don't know to be honest, at some point I suspected, that the domain
would not be able to resolve the resource with the code here in the
Remove command. But this would require more investigation. I will need
to find time for this. For now, I have a workaround. BTW, I noticed that
CDO also has specialized implementations of the .edit framework. Perhaps
it's already addressed there..


@Override
protected boolean prepare()
{
// This can execute if there is an owner list and a collection and
the owner list contains all the objects of the collection.
//
boolean result =
ownerList != null &&
collection != null &&
ownerList.containsAll(collection) &&
(owner == null || !domain.isReadOnly(owner.eResource()));

return result;
}

Thanks for your support!
Christophe


On 19-10-11 11:35, Eike Stepper wrote:
> Am 19.10.2011 09:08, schrieb Christophe Bouhier:
>> Eike,
>>
>> I found the problem. The RemoveCommand for the Reference B->A was not
>> "executable".
>>
>> RemoveCommand.create(domain, referencingEObject,
>> eStructuralFeature, eObject)
>>
>> I have tried a similar case which is not a bidi reference (No
>> EOpposite), and then the remove command works as expected.
> I'm not very experienced with the edit framework because CDO mostly
> operates on the model level. Does that mean your problem is either
> solved or not CDO-related?
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
Re: [CDO] dangling reference on deleted object. [message #741397 is a reply to message #741237] Wed, 19 October 2011 13:44 Go to previous messageGo to next message
Claes Rosell is currently offline Claes RosellFriend
Messages: 17
Registered: July 2009
Junior Member
Hi.

This seems to be related to the problem that I had, evaluating CDO, last
year. Something that I not yet have found time to finish.

Here is an extract from the email I sent to this list back then. If
these two problems are related, the following information might be
useful to you.

/Claes

<--->
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(AbstractCDOIDLong.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.contains(BaseCDORevision.java:414)
at org.eclipse.emf.internal.cdo.CDOStore.contains(CDOStore.java:244)
at
org.eclipse.emf.ecore.impl.EStoreEObjectImpl$BasicEStoreEList.delegateContains(EStoreEObjectImpl.java:227)
at
org.eclipse.emf.ecore.impl.EStoreEObjectImpl$BasicEStoreEList.delegateContainsAll(EStoreEObjectImpl.java:235)
at
org.eclipse.emf.common.util.DelegatingEList.containsAll(DelegatingEList.java:125)
at
org.eclipse.emf.edit.command.RemoveCommand.prepare(RemoveCommand.java:248)
at
org.eclipse.emf.common.command.AbstractCommand.canExecute(AbstractCommand.java:114)
at
org.eclipse.emf.edit.command.AbstractOverrideableCommand.doCanExecute(AbstractOverrideableCommand.java:120)
at
org.eclipse.emf.edit.command.AbstractOverrideableCommand.canExecute(AbstractOverrideableCommand.java:113)
at
org.eclipse.emf.common.command.CompoundCommand.appendAndExecute(CompoundCommand.java:656)



Christophe Bouhier skrev 2011-10-19 12:20:
> Hi Eike,
>
> I don't know to be honest, at some point I suspected, that the domain
> would not be able to resolve the resource with the code here in the
> Remove command. But this would require more investigation. I will need
> to find time for this. For now, I have a workaround. BTW, I noticed that
> CDO also has specialized implementations of the .edit framework. Perhaps
> it's already addressed there..
>
>
> @Override
> protected boolean prepare()
> {
> // This can execute if there is an owner list and a collection and the
> owner list contains all the objects of the collection.
> //
> boolean result =
> ownerList != null &&
> collection != null &&
> ownerList.containsAll(collection) &&
> (owner == null || !domain.isReadOnly(owner.eResource()));
>
> return result;
> }
>
> Thanks for your support!
> Christophe
>
>
> On 19-10-11 11:35, Eike Stepper wrote:
>> Am 19.10.2011 09:08, schrieb Christophe Bouhier:
>>> Eike,
>>>
>>> I found the problem. The RemoveCommand for the Reference B->A was not
>>> "executable".
>>>
>>> RemoveCommand.create(domain, referencingEObject,
>>> eStructuralFeature, eObject)
>>>
>>> I have tried a similar case which is not a bidi reference (No
>>> EOpposite), and then the remove command works as expected.
>> I'm not very experienced with the edit framework because CDO mostly
>> operates on the model level. Does that mean your problem is either
>> solved or not CDO-related?
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>
Re: [CDO] dangling reference on deleted object. [message #741591 is a reply to message #741397] Wed, 19 October 2011 17:33 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
On 19-10-11 15:44, Claes Rosell wrote:

Hi Claes,

Well this sounds indeed very much like it.
Did you by change created a bug for this?

thank you, rgds Christophe

> Hi.
>
> This seems to be related to the problem that I had, evaluating CDO, last
> year. Something that I not yet have found time to finish.
>
> Here is an extract from the email I sent to this list back then. If
> these two problems are related, the following information might be
> useful to you.
>
> /Claes
>
> <--->
> 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(AbstractCDOIDLong.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.contains(BaseCDORevision.java:414)
>
> at org.eclipse.emf.internal.cdo.CDOStore.contains(CDOStore.java:244)
> at
> org.eclipse.emf.ecore.impl.EStoreEObjectImpl$BasicEStoreEList.delegateContains(EStoreEObjectImpl.java:227)
>
> at
> org.eclipse.emf.ecore.impl.EStoreEObjectImpl$BasicEStoreEList.delegateContainsAll(EStoreEObjectImpl.java:235)
>
> at
> org.eclipse.emf.common.util.DelegatingEList.containsAll(DelegatingEList.java:125)
>
> at
> org.eclipse.emf.edit.command.RemoveCommand.prepare(RemoveCommand.java:248)
> at
> org.eclipse.emf.common.command.AbstractCommand.canExecute(AbstractCommand.java:114)
>
> at
> org.eclipse.emf.edit.command.AbstractOverrideableCommand.doCanExecute(AbstractOverrideableCommand.java:120)
>
> at
> org.eclipse.emf.edit.command.AbstractOverrideableCommand.canExecute(AbstractOverrideableCommand.java:113)
>
> at
> org.eclipse.emf.common.command.CompoundCommand.appendAndExecute(CompoundCommand.java:656)
>
>
>
> Christophe Bouhier skrev 2011-10-19 12:20:
>> Hi Eike,
>>
>> I don't know to be honest, at some point I suspected, that the domain
>> would not be able to resolve the resource with the code here in the
>> Remove command. But this would require more investigation. I will need
>> to find time for this. For now, I have a workaround. BTW, I noticed that
>> CDO also has specialized implementations of the .edit framework. Perhaps
>> it's already addressed there..
>>
>>
>> @Override
>> protected boolean prepare()
>> {
>> // This can execute if there is an owner list and a collection and the
>> owner list contains all the objects of the collection.
>> //
>> boolean result =
>> ownerList != null &&
>> collection != null &&
>> ownerList.containsAll(collection) &&
>> (owner == null || !domain.isReadOnly(owner.eResource()));
>>
>> return result;
>> }
>>
>> Thanks for your support!
>> Christophe
>>
>>
>> On 19-10-11 11:35, Eike Stepper wrote:
>>> Am 19.10.2011 09:08, schrieb Christophe Bouhier:
>>>> Eike,
>>>>
>>>> I found the problem. The RemoveCommand for the Reference B->A was not
>>>> "executable".
>>>>
>>>> RemoveCommand.create(domain, referencingEObject,
>>>> eStructuralFeature, eObject)
>>>>
>>>> I have tried a similar case which is not a bidi reference (No
>>>> EOpposite), and then the remove command works as expected.
>>> I'm not very experienced with the edit framework because CDO mostly
>>> operates on the model level. Does that mean your problem is either
>>> solved or not CDO-related?
>>>
>>> Cheers
>>> /Eike
>>>
>>> ----
>>> http://www.esc-net.de
>>> http://thegordian.blogspot.com
>>> http://twitter.com/eikestepper
>>>
>>>
>>
>
Re: [CDO] dangling reference on deleted object. [message #742176 is a reply to message #741397] Thu, 20 October 2011 08:49 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 19.10.2011 15:44, schrieb Claes Rosell:
> Hi.
>
> This seems to be related to the problem that I had, evaluating CDO, last year. Something that I not yet have found
> time to finish.
>
> Here is an extract from the email I sent to this list back then. If these two problems are related, the following
> information might be useful to you.
>
> /Claes
>
> <--->
> 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.
Well, that sounds like bug 350987:
Revision compare does not consider EObject values in references
https://bugs.eclipse.org/bugs/show_bug.cgi?id=350987


> Is it valid for a feature-list of CDORevision to contain other things that CDOIDs?
Yes, this usually happens in dirty local transactions when a referenced object doesn't have a CDOID, yet, or not
anymore. It's supposed to be either fixed (replaced by a CDOID at commit time).

>
> This problem seems to exist for indexOf() and lastIndexOf() as well.
We're currently discussing this issue within the team...

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


>
> Best regards
> /Claes
>
> Stacktrace:
>
> at org.eclipse.emf.cdo.spi.common.id.AbstractCDOIDLong.equals(AbstractCDOIDLong.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.contains(BaseCDORevision.java:414)
> at org.eclipse.emf.internal.cdo.CDOStore.contains(CDOStore.java:244)
> at org.eclipse.emf.ecore.impl.EStoreEObjectImpl$BasicEStoreEList.delegateContains(EStoreEObjectImpl.java:227)
> at org.eclipse.emf.ecore.impl.EStoreEObjectImpl$BasicEStoreEList.delegateContainsAll(EStoreEObjectImpl.java:235)
> at org.eclipse.emf.common.util.DelegatingEList.containsAll(DelegatingEList.java:125)
> at org.eclipse.emf.edit.command.RemoveCommand.prepare(RemoveCommand.java:248)
> at org.eclipse.emf.common.command.AbstractCommand.canExecute(AbstractCommand.java:114)
> at org.eclipse.emf.edit.command.AbstractOverrideableCommand.doCanExecute(AbstractOverrideableCommand.java:120)
> at org.eclipse.emf.edit.command.AbstractOverrideableCommand.canExecute(AbstractOverrideableCommand.java:113)
> at org.eclipse.emf.common.command.CompoundCommand.appendAndExecute(CompoundCommand.java:656)
>
>
> Christophe Bouhier skrev 2011-10-19 12:20:
>> Hi Eike,
>>
>> I don't know to be honest, at some point I suspected, that the domain
>> would not be able to resolve the resource with the code here in the
>> Remove command. But this would require more investigation. I will need
>> to find time for this. For now, I have a workaround. BTW, I noticed that
>> CDO also has specialized implementations of the .edit framework. Perhaps
>> it's already addressed there..
>>
>>
>> @Override
>> protected boolean prepare()
>> {
>> // This can execute if there is an owner list and a collection and the
>> owner list contains all the objects of the collection.
>> //
>> boolean result =
>> ownerList != null &&
>> collection != null &&
>> ownerList.containsAll(collection) &&
>> (owner == null || !domain.isReadOnly(owner.eResource()));
>>
>> return result;
>> }
>>
>> Thanks for your support!
>> Christophe
>>
>>
>> On 19-10-11 11:35, Eike Stepper wrote:
>>> Am 19.10.2011 09:08, schrieb Christophe Bouhier:
>>>> Eike,
>>>>
>>>> I found the problem. The RemoveCommand for the Reference B->A was not
>>>> "executable".
>>>>
>>>> RemoveCommand.create(domain, referencingEObject,
>>>> eStructuralFeature, eObject)
>>>>
>>>> I have tried a similar case which is not a bidi reference (No
>>>> EOpposite), and then the remove command works as expected.
>>> I'm not very experienced with the edit framework because CDO mostly
>>> operates on the model level. Does that mean your problem is either
>>> solved or not CDO-related?
>>>
>>> Cheers
>>> /Eike
>>>
>>> ----
>>> http://www.esc-net.de
>>> http://thegordian.blogspot.com
>>> http://twitter.com/eikestepper
>>>
>>>
>>
>


Re: [CDO] dangling reference on deleted object. [message #742199 is a reply to message #741591] Thu, 20 October 2011 09:16 Go to previous message
Claes Rosell is currently offline Claes RosellFriend
Messages: 17
Registered: July 2009
Junior Member
Hi.

I did open a bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=316273
However, I was not persuasive enough in my attempts to explain the
actual problem. Since then I have unfortunately had very little time to
experiment with CDO. I have not tested CDO4.0 at all.

Best regards
/Claes


Christophe Bouhier skrev 2011-10-19 19:33:
> On 19-10-11 15:44, Claes Rosell wrote:
>
> Hi Claes,
>
> Well this sounds indeed very much like it.
> Did you by change created a bug for this?
>
> thank you, rgds Christophe
>
>> Hi.
>>
>> This seems to be related to the problem that I had, evaluating CDO, last
>> year. Something that I not yet have found time to finish.
>>
>> Here is an extract from the email I sent to this list back then. If
>> these two problems are related, the following information might be
>> useful to you.
>>
>> /Claes
>>
>> <--->
>> 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(AbstractCDOIDLong.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.contains(BaseCDORevision.java:414)
>>
>>
>> at org.eclipse.emf.internal.cdo.CDOStore.contains(CDOStore.java:244)
>> at
>> org.eclipse.emf.ecore.impl.EStoreEObjectImpl$BasicEStoreEList.delegateContains(EStoreEObjectImpl.java:227)
>>
>>
>> at
>> org.eclipse.emf.ecore.impl.EStoreEObjectImpl$BasicEStoreEList.delegateContainsAll(EStoreEObjectImpl.java:235)
>>
>>
>> at
>> org.eclipse.emf.common.util.DelegatingEList.containsAll(DelegatingEList.java:125)
>>
>>
>> at
>> org.eclipse.emf.edit.command.RemoveCommand.prepare(RemoveCommand.java:248)
>>
>> at
>> org.eclipse.emf.common.command.AbstractCommand.canExecute(AbstractCommand.java:114)
>>
>>
>> at
>> org.eclipse.emf.edit.command.AbstractOverrideableCommand.doCanExecute(AbstractOverrideableCommand.java:120)
>>
>>
>> at
>> org.eclipse.emf.edit.command.AbstractOverrideableCommand.canExecute(AbstractOverrideableCommand.java:113)
>>
>>
>> at
>> org.eclipse.emf.common.command.CompoundCommand.appendAndExecute(CompoundCommand.java:656)
>>
>>
>>
>>
>> Christophe Bouhier skrev 2011-10-19 12:20:
>>> Hi Eike,
>>>
>>> I don't know to be honest, at some point I suspected, that the domain
>>> would not be able to resolve the resource with the code here in the
>>> Remove command. But this would require more investigation. I will need
>>> to find time for this. For now, I have a workaround. BTW, I noticed that
>>> CDO also has specialized implementations of the .edit framework. Perhaps
>>> it's already addressed there..
>>>
>>>
>>> @Override
>>> protected boolean prepare()
>>> {
>>> // This can execute if there is an owner list and a collection and the
>>> owner list contains all the objects of the collection.
>>> //
>>> boolean result =
>>> ownerList != null &&
>>> collection != null &&
>>> ownerList.containsAll(collection) &&
>>> (owner == null || !domain.isReadOnly(owner.eResource()));
>>>
>>> return result;
>>> }
>>>
>>> Thanks for your support!
>>> Christophe
>>>
>>>
>>> On 19-10-11 11:35, Eike Stepper wrote:
>>>> Am 19.10.2011 09:08, schrieb Christophe Bouhier:
>>>>> Eike,
>>>>>
>>>>> I found the problem. The RemoveCommand for the Reference B->A was not
>>>>> "executable".
>>>>>
>>>>> RemoveCommand.create(domain, referencingEObject,
>>>>> eStructuralFeature, eObject)
>>>>>
>>>>> I have tried a similar case which is not a bidi reference (No
>>>>> EOpposite), and then the remove command works as expected.
>>>> I'm not very experienced with the edit framework because CDO mostly
>>>> operates on the model level. Does that mean your problem is either
>>>> solved or not CDO-related?
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>> ----
>>>> http://www.esc-net.de
>>>> http://thegordian.blogspot.com
>>>> http://twitter.com/eikestepper
>>>>
>>>>
>>>
>>
>
Previous Topic:How to update the model from code
Next Topic:How to create a &quot;singleton&quot; resource in memory
Goto Forum:
  


Current Time: Fri Apr 26 15:52:17 GMT 2024

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

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

Back to the top