Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] NPE when removing an object in containment tree
[CDO] NPE when removing an object in containment tree [message #425527] Sun, 30 November 2008 23:16 Go to next message
Mark Geib is currently offline Mark GeibFriend
Messages: 432
Registered: July 2009
Senior Member
I am running CDO/NET4J 1.0.4 on Linux, Eclipse 3.4.1.

I seem to not be able to remove an object from my model, which is CDO
backed. The object I am trying to remove is in the 'middle' of a
containment tree. That is, the object I am removing contains other
object which in turn contain other objects, etc. Also, the containment
tree includes collections that are in a hashmap.

Doing some trial and error it seems that I can't do any remove on the
repository at all with the resulting NPE.

Exception in thread "main" java.lang.NullPointerException
at
org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:447)
at
org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:1)
at
org.eclipse.net4j.util.fsm.FiniteStateMachine.process(Finite StateMachine.java:161)
at
org.eclipse.emf.internal.cdo.CDOStateMachine.commit(CDOState Machine.java:275)
at
org.eclipse.emf.internal.cdo.CDOTransactionImpl.postCommit(C DOTransactionImpl.java:487)
at
org.eclipse.emf.internal.cdo.CDOTransactionImpl.commit(CDOTr ansactionImpl.java:251)
at dm.util.DmModelManager.save(DmModelManager.java:189)
at cse.dm.modelManager.Dm522.removeSectionContents(Dm522.java:3 27)
Re: [CDO] NPE when removing an object in containment tree [message #425528 is a reply to message #425527] Sun, 30 November 2008 23:49 Go to previous messageGo to next message
Mark Geib is currently offline Mark GeibFriend
Messages: 432
Registered: July 2009
Senior Member
Some more info.

The NPE occurs somewhere within the call to
"postCommit(dirtyObjects,result);" in CDOTransactionImpl.commit()

It looks like the object dirtyObjects contains two items, the object
that contains the object being removed and the removed object itself.
The NPE occurs when processing the removed object, not the object that
once contained the removed object.

Mark.

Mark Geib wrote:
> I am running CDO/NET4J 1.0.4 on Linux, Eclipse 3.4.1.
>
> I seem to not be able to remove an object from my model, which is CDO
> backed. The object I am trying to remove is in the 'middle' of a
> containment tree. That is, the object I am removing contains other
> object which in turn contain other objects, etc. Also, the containment
> tree includes collections that are in a hashmap.
>
> Doing some trial and error it seems that I can't do any remove on the
> repository at all with the resulting NPE.
>
> Exception in thread "main" java.lang.NullPointerException
> at
> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:447)
>
> at
> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:1)
>
> at
> org.eclipse.net4j.util.fsm.FiniteStateMachine.process(Finite StateMachine.java:161)
>
> at
> org.eclipse.emf.internal.cdo.CDOStateMachine.commit(CDOState Machine.java:275)
>
> at
> org.eclipse.emf.internal.cdo.CDOTransactionImpl.postCommit(C DOTransactionImpl.java:487)
>
> at
> org.eclipse.emf.internal.cdo.CDOTransactionImpl.commit(CDOTr ansactionImpl.java:251)
>
> at dm.util.DmModelManager.save(DmModelManager.java:189)
> at cse.dm.modelManager.Dm522.removeSectionContents(Dm522.java:3 27)
Re: [CDO] NPE when removing an object in containment tree [message #425530 is a reply to message #425528] Mon, 01 December 2008 00:22 Go to previous messageGo to next message
Mark Geib is currently offline Mark GeibFriend
Messages: 432
Registered: July 2009
Senior Member
More info.

Found that the state machine 'event' is being set to COMMIT for the
object being removed, instead of DETACH. By stepping into the process
method and changing the event to DETACH the operation completed with no
NPE. The event on the containing object is set to COMMIT as expected.

Mark.




Mark Geib wrote:
> Some more info.
>
> The NPE occurs somewhere within the call to
> "postCommit(dirtyObjects,result);" in CDOTransactionImpl.commit()
>
> It looks like the object dirtyObjects contains two items, the object
> that contains the object being removed and the removed object itself.
> The NPE occurs when processing the removed object, not the object that
> once contained the removed object.
>
> Mark.
>
> Mark Geib wrote:
>> I am running CDO/NET4J 1.0.4 on Linux, Eclipse 3.4.1.
>>
>> I seem to not be able to remove an object from my model, which is CDO
>> backed. The object I am trying to remove is in the 'middle' of a
>> containment tree. That is, the object I am removing contains other
>> object which in turn contain other objects, etc. Also, the containment
>> tree includes collections that are in a hashmap.
>>
>> Doing some trial and error it seems that I can't do any remove on the
>> repository at all with the resulting NPE.
>>
>> Exception in thread "main" java.lang.NullPointerException
>> at
>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:447)
>>
>> at
>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:1)
>>
>> at
>> org.eclipse.net4j.util.fsm.FiniteStateMachine.process(Finite StateMachine.java:161)
>>
>> at
>> org.eclipse.emf.internal.cdo.CDOStateMachine.commit(CDOState Machine.java:275)
>>
>> at
>> org.eclipse.emf.internal.cdo.CDOTransactionImpl.postCommit(C DOTransactionImpl.java:487)
>>
>> at
>> org.eclipse.emf.internal.cdo.CDOTransactionImpl.commit(CDOTr ansactionImpl.java:251)
>>
>> at dm.util.DmModelManager.save(DmModelManager.java:189)
>> at cse.dm.modelManager.Dm522.removeSectionContents(Dm522.java:3 27)
Re: [CDO] NPE when removing an object in containment tree [message #425536 is a reply to message #425530] Mon, 01 December 2008 10:42 Go to previous messageGo to next message
Victor Roldan Betancort is currently offline Victor Roldan BetancortFriend
Messages: 524
Registered: July 2009
Senior Member
Hi Mark,

are you using DBStore? I believe the 1.x stream didn't have support for
detach operations. That was recently introduced in 2.x.

Mark Geib escribió:
> More info.
>
> Found that the state machine 'event' is being set to COMMIT for the
> object being removed, instead of DETACH. By stepping into the process
> method and changing the event to DETACH the operation completed with no
> NPE. The event on the containing object is set to COMMIT as expected.
>
> Mark.
>
>
>
>
> Mark Geib wrote:
>> Some more info.
>>
>> The NPE occurs somewhere within the call to
>> "postCommit(dirtyObjects,result);" in CDOTransactionImpl.commit()
>>
>> It looks like the object dirtyObjects contains two items, the object
>> that contains the object being removed and the removed object itself.
>> The NPE occurs when processing the removed object, not the object that
>> once contained the removed object.
>>
>> Mark.
>>
>> Mark Geib wrote:
>>> I am running CDO/NET4J 1.0.4 on Linux, Eclipse 3.4.1.
>>>
>>> I seem to not be able to remove an object from my model, which is CDO
>>> backed. The object I am trying to remove is in the 'middle' of a
>>> containment tree. That is, the object I am removing contains other
>>> object which in turn contain other objects, etc. Also, the
>>> containment tree includes collections that are in a hashmap.
>>>
>>> Doing some trial and error it seems that I can't do any remove on the
>>> repository at all with the resulting NPE.
>>>
>>> Exception in thread "main" java.lang.NullPointerException
>>> at
>>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:447)
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:1)
>>>
>>> at
>>> org.eclipse.net4j.util.fsm.FiniteStateMachine.process(Finite StateMachine.java:161)
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.CDOStateMachine.commit(CDOState Machine.java:275)
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.CDOTransactionImpl.postCommit(C DOTransactionImpl.java:487)
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.CDOTransactionImpl.commit(CDOTr ansactionImpl.java:251)
>>>
>>> at dm.util.DmModelManager.save(DmModelManager.java:189)
>>> at cse.dm.modelManager.Dm522.removeSectionContents(Dm522.java:3 27)
Re: [CDO] NPE when removing an object in containment tree [message #425537 is a reply to message #425527] Mon, 01 December 2008 10:42 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Mark,

I fear that detaching objects from the persistent object graph is known
to be a missing feature in the 1.0 version ;-(
We were not able to complete this feature before Ganymede and I think it
won't be possible to add it in the manitenance stream due to required
API changes that would make the fix binary incompatible. Since Simon
implemented this feature in the 2.0 stream I will discuss this issue
with him. Let's see what he thinks...

Cheers
/Eike

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



Mark Geib schrieb:
> I am running CDO/NET4J 1.0.4 on Linux, Eclipse 3.4.1.
>
> I seem to not be able to remove an object from my model, which is CDO
> backed. The object I am trying to remove is in the 'middle' of a
> containment tree. That is, the object I am removing contains other
> object which in turn contain other objects, etc. Also, the containment
> tree includes collections that are in a hashmap.
>
> Doing some trial and error it seems that I can't do any remove on the
> repository at all with the resulting NPE.
>
> Exception in thread "main" java.lang.NullPointerException
> at
> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:447)
>
> at
> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:1)
>
> at
> org.eclipse.net4j.util.fsm.FiniteStateMachine.process(Finite StateMachine.java:161)
>
> at
> org.eclipse.emf.internal.cdo.CDOStateMachine.commit(CDOState Machine.java:275)
>
> at
> org.eclipse.emf.internal.cdo.CDOTransactionImpl.postCommit(C DOTransactionImpl.java:487)
>
> at
> org.eclipse.emf.internal.cdo.CDOTransactionImpl.commit(CDOTr ansactionImpl.java:251)
>
> at dm.util.DmModelManager.save(DmModelManager.java:189)
> at cse.dm.modelManager.Dm522.removeSectionContents(Dm522.java:3 27)


Re: [CDO] NPE when removing an object in containment tree [message #425538 is a reply to message #425536] Mon, 01 December 2008 10:44 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Vik,

This is more (but possibly not only) a client-side problem with the
CDOStateMachine.

Cheers
/Eike

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



Víctor Roldán Betancort schrieb:
> Hi Mark,
>
> are you using DBStore? I believe the 1.x stream didn't have support
> for detach operations. That was recently introduced in 2.x.
>
> Mark Geib escribió:
>> More info.
>>
>> Found that the state machine 'event' is being set to COMMIT for the
>> object being removed, instead of DETACH. By stepping into the process
>> method and changing the event to DETACH the operation completed with
>> no NPE. The event on the containing object is set to COMMIT as expected.
>>
>> Mark.
>>
>>
>>
>>
>> Mark Geib wrote:
>>> Some more info.
>>>
>>> The NPE occurs somewhere within the call to
>>> "postCommit(dirtyObjects,result);" in CDOTransactionImpl.commit()
>>>
>>> It looks like the object dirtyObjects contains two items, the object
>>> that contains the object being removed and the removed object
>>> itself. The NPE occurs when processing the removed object, not the
>>> object that once contained the removed object.
>>>
>>> Mark.
>>>
>>> Mark Geib wrote:
>>>> I am running CDO/NET4J 1.0.4 on Linux, Eclipse 3.4.1.
>>>>
>>>> I seem to not be able to remove an object from my model, which is
>>>> CDO backed. The object I am trying to remove is in the 'middle' of
>>>> a containment tree. That is, the object I am removing contains
>>>> other object which in turn contain other objects, etc. Also, the
>>>> containment tree includes collections that are in a hashmap.
>>>>
>>>> Doing some trial and error it seems that I can't do any remove on
>>>> the repository at all with the resulting NPE.
>>>>
>>>> Exception in thread "main" java.lang.NullPointerException
>>>> at
>>>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:447)
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:1)
>>>>
>>>> at
>>>> org.eclipse.net4j.util.fsm.FiniteStateMachine.process(Finite StateMachine.java:161)
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.CDOStateMachine.commit(CDOState Machine.java:275)
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.CDOTransactionImpl.postCommit(C DOTransactionImpl.java:487)
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.CDOTransactionImpl.commit(CDOTr ansactionImpl.java:251)
>>>>
>>>> at dm.util.DmModelManager.save(DmModelManager.java:189)
>>>> at cse.dm.modelManager.Dm522.removeSectionContents(Dm522.java:3 27)


Re: [CDO] NPE when removing an object in containment tree [message #425548 is a reply to message #425537] Mon, 01 December 2008 14:05 Go to previous messageGo to next message
Simon Mc Duff is currently offline Simon Mc DuffFriend
Messages: 596
Registered: July 2009
Senior Member
Hi Mark and Eike,

Detach feature was introduced in 2.0. (Nothing new.. Eike already
mentionned it)

However, without implementing this features we could make sure that the
exception do not occurred.. but objects will not be removed from your
persistence layer(back-end) even if it is not referenced by any objects.
The exception will not occurred and your data will behave as you expect.
It is possible that we had some bugs in the way we handle containment
relationship.... so maybe we will have a bugs there!!! (This is the
place where detach could occurred)

Mark, Is it acceptable for you ?

Eike, can we change the internal API for a maintenance stream ?
We will only need to add CDOTRansactionImpl.detachObject().


Simon


Eike Stepper wrote:
> Mark,
>
> I fear that detaching objects from the persistent object graph is known
> to be a missing feature in the 1.0 version ;-(
> We were not able to complete this feature before Ganymede and I think it
> won't be possible to add it in the manitenance stream due to required
> API changes that would make the fix binary incompatible. Since Simon
> implemented this feature in the 2.0 stream I will discuss this issue
> with him. Let's see what he thinks...
>
> Cheers
> /Eike
>
> ----
> http://thegordian.blogspot.com
>
>
>
> Mark Geib schrieb:
>> I am running CDO/NET4J 1.0.4 on Linux, Eclipse 3.4.1.
>>
>> I seem to not be able to remove an object from my model, which is CDO
>> backed. The object I am trying to remove is in the 'middle' of a
>> containment tree. That is, the object I am removing contains other
>> object which in turn contain other objects, etc. Also, the containment
>> tree includes collections that are in a hashmap.
>>
>> Doing some trial and error it seems that I can't do any remove on the
>> repository at all with the resulting NPE.
>>
>> Exception in thread "main" java.lang.NullPointerException
>> at
>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:447)
>>
>> at
>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:1)
>>
>> at
>> org.eclipse.net4j.util.fsm.FiniteStateMachine.process(Finite StateMachine.java:161)
>>
>> at
>> org.eclipse.emf.internal.cdo.CDOStateMachine.commit(CDOState Machine.java:275)
>>
>> at
>> org.eclipse.emf.internal.cdo.CDOTransactionImpl.postCommit(C DOTransactionImpl.java:487)
>>
>> at
>> org.eclipse.emf.internal.cdo.CDOTransactionImpl.commit(CDOTr ansactionImpl.java:251)
>>
>> at dm.util.DmModelManager.save(DmModelManager.java:189)
>> at cse.dm.modelManager.Dm522.removeSectionContents(Dm522.java:3 27)
Re: [CDO] NPE when removing an object in containment tree [message #425549 is a reply to message #425548] Mon, 01 December 2008 14:14 Go to previous messageGo to next message
Simon Mc Duff is currently offline Simon Mc DuffFriend
Messages: 596
Registered: July 2009
Senior Member
Oh yeah forgot also to mentionned the following:
This can lead us to modify many things :

- depopulation a CDOObject.. We fixed some issue there.
- Introducing the cdoSettings...

Mark, the objects you wanted to detach.. do you want to reuse them in
another context. If you say no, we could remove completely the detach
even in the state machine!! SO this objects, even if it is not link...
will not occurred a NPE.

What do you think Eike ? (To remove only the even in the State machine)

Otherwise it could lead us to many many modifications!!

Simon

Simon McDuff wrote:
> Hi Mark and Eike,
>
> Detach feature was introduced in 2.0. (Nothing new.. Eike already
> mentionned it)
>
> However, without implementing this features we could make sure that the
> exception do not occurred.. but objects will not be removed from your
> persistence layer(back-end) even if it is not referenced by any objects.
> The exception will not occurred and your data will behave as you expect.
> It is possible that we had some bugs in the way we handle containment
> relationship.... so maybe we will have a bugs there!!! (This is the
> place where detach could occurred)
>
> Mark, Is it acceptable for you ?
>
> Eike, can we change the internal API for a maintenance stream ?
> We will only need to add CDOTRansactionImpl.detachObject().
>
>
> Simon
>
>
> Eike Stepper wrote:
>> Mark,
>>
>> I fear that detaching objects from the persistent object graph is
>> known to be a missing feature in the 1.0 version ;-(
>> We were not able to complete this feature before Ganymede and I think
>> it won't be possible to add it in the manitenance stream due to
>> required API changes that would make the fix binary incompatible.
>> Since Simon implemented this feature in the 2.0 stream I will discuss
>> this issue with him. Let's see what he thinks...
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://thegordian.blogspot.com
>>
>>
>>
>> Mark Geib schrieb:
>>> I am running CDO/NET4J 1.0.4 on Linux, Eclipse 3.4.1.
>>>
>>> I seem to not be able to remove an object from my model, which is CDO
>>> backed. The object I am trying to remove is in the 'middle' of a
>>> containment tree. That is, the object I am removing contains other
>>> object which in turn contain other objects, etc. Also, the
>>> containment tree includes collections that are in a hashmap.
>>>
>>> Doing some trial and error it seems that I can't do any remove on the
>>> repository at all with the resulting NPE.
>>>
>>> Exception in thread "main" java.lang.NullPointerException
>>> at
>>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:447)
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:1)
>>>
>>> at
>>> org.eclipse.net4j.util.fsm.FiniteStateMachine.process(Finite StateMachine.java:161)
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.CDOStateMachine.commit(CDOState Machine.java:275)
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.CDOTransactionImpl.postCommit(C DOTransactionImpl.java:487)
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.CDOTransactionImpl.commit(CDOTr ansactionImpl.java:251)
>>>
>>> at dm.util.DmModelManager.save(DmModelManager.java:189)
>>> at cse.dm.modelManager.Dm522.removeSectionContents(Dm522.java:3 27)
Re: [CDO] NPE when removing an object in containment tree [message #425554 is a reply to message #425549] Mon, 01 December 2008 14:53 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Simon McDuff schrieb:
> Oh yeah forgot also to mentionned the following:
> This can lead us to modify many things :
>
> - depopulation a CDOObject.. We fixed some issue there.
> - Introducing the cdoSettings...
>
> Mark, the objects you wanted to detach.. do you want to reuse them in
> another context. If you say no, we could remove completely the detach
> even in the state machine!! SO this objects, even if it is not link...
> will not occurred a NPE.
>
> What do you think Eike ? (To remove only the even in the State machine)
Hmm, I fear that we open Pandora's box when we try to address this issue
in the maintenance stream ;-(
In the end we are likely to run against the "binary compatibility wall".

Mark, doy ou see a way to switch to the 2.0 integration builds already?

Cheers
/Eike

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


>
> Otherwise it could lead us to many many modifications!!
>
> Simon
>
> Simon McDuff wrote:
>> Hi Mark and Eike,
>>
>> Detach feature was introduced in 2.0. (Nothing new.. Eike already
>> mentionned it)
>>
>> However, without implementing this features we could make sure that
>> the exception do not occurred.. but objects will not be removed from
>> your persistence layer(back-end) even if it is not referenced by any
>> objects. The exception will not occurred and your data will behave
>> as you expect.
>> It is possible that we had some bugs in the way we handle containment
>> relationship.... so maybe we will have a bugs there!!! (This is the
>> place where detach could occurred)
>>
>> Mark, Is it acceptable for you ?
>>
>> Eike, can we change the internal API for a maintenance stream ?
>> We will only need to add CDOTRansactionImpl.detachObject().
>>
>>
>> Simon
>>
>>
>> Eike Stepper wrote:
>>> Mark,
>>>
>>> I fear that detaching objects from the persistent object graph is
>>> known to be a missing feature in the 1.0 version ;-(
>>> We were not able to complete this feature before Ganymede and I
>>> think it won't be possible to add it in the manitenance stream due
>>> to required API changes that would make the fix binary incompatible.
>>> Since Simon implemented this feature in the 2.0 stream I will
>>> discuss this issue with him. Let's see what he thinks...
>>>
>>> Cheers
>>> /Eike
>>>
>>> ----
>>> http://thegordian.blogspot.com
>>>
>>>
>>>
>>> Mark Geib schrieb:
>>>> I am running CDO/NET4J 1.0.4 on Linux, Eclipse 3.4.1.
>>>>
>>>> I seem to not be able to remove an object from my model, which is
>>>> CDO backed. The object I am trying to remove is in the 'middle' of
>>>> a containment tree. That is, the object I am removing contains
>>>> other object which in turn contain other objects, etc. Also, the
>>>> containment tree includes collections that are in a hashmap.
>>>>
>>>> Doing some trial and error it seems that I can't do any remove on
>>>> the repository at all with the resulting NPE.
>>>>
>>>> Exception in thread "main" java.lang.NullPointerException
>>>> at
>>>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:447)
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:1)
>>>>
>>>> at
>>>> org.eclipse.net4j.util.fsm.FiniteStateMachine.process(Finite StateMachine.java:161)
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.CDOStateMachine.commit(CDOState Machine.java:275)
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.CDOTransactionImpl.postCommit(C DOTransactionImpl.java:487)
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.CDOTransactionImpl.commit(CDOTr ansactionImpl.java:251)
>>>>
>>>> at dm.util.DmModelManager.save(DmModelManager.java:189)
>>>> at cse.dm.modelManager.Dm522.removeSectionContents(Dm522.java:3 27)


Re: [CDO] NPE when removing an object in containment tree [message #425556 is a reply to message #425554] Mon, 01 December 2008 15:57 Go to previous messageGo to next message
Mark Geib is currently offline Mark GeibFriend
Messages: 432
Registered: July 2009
Senior Member
Eike/Simon/Vik,

Thanks for the responses, but not the news...

I am not sure it is possible for us to switch to the new 2.0 at this
point. That I assume would require us to move to Eclipse 3.5 ...EMF...??

The bigger problem we have is that this new system absolutely depends on
be able to delete an existing object, and all that it contains, and then
replacing with a new object, and containment tree, that has the same
'signature' as the old object in our system. I assume that the it is the
remove of the object from a list that is not supported, so we could not
just change the containment to a 'trashCan' object to handle latter..?

I will also discuss with my team.

Mark.



Eike Stepper wrote:
> Simon McDuff schrieb:
>> Oh yeah forgot also to mentionned the following:
>> This can lead us to modify many things :
>>
>> - depopulation a CDOObject.. We fixed some issue there.
>> - Introducing the cdoSettings...
>>
>> Mark, the objects you wanted to detach.. do you want to reuse them in
>> another context. If you say no, we could remove completely the detach
>> even in the state machine!! SO this objects, even if it is not link...
>> will not occurred a NPE.
>>
>> What do you think Eike ? (To remove only the even in the State machine)
> Hmm, I fear that we open Pandora's box when we try to address this issue
> in the maintenance stream ;-(
> In the end we are likely to run against the "binary compatibility wall".
>
> Mark, doy ou see a way to switch to the 2.0 integration builds already?
>
> Cheers
> /Eike
>
> ----
> http://thegordian.blogspot.com
>
>
>>
>> Otherwise it could lead us to many many modifications!!
>>
>> Simon
>>
>> Simon McDuff wrote:
>>> Hi Mark and Eike,
>>>
>>> Detach feature was introduced in 2.0. (Nothing new.. Eike already
>>> mentionned it)
>>>
>>> However, without implementing this features we could make sure that
>>> the exception do not occurred.. but objects will not be removed from
>>> your persistence layer(back-end) even if it is not referenced by any
>>> objects. The exception will not occurred and your data will behave
>>> as you expect.
>>> It is possible that we had some bugs in the way we handle containment
>>> relationship.... so maybe we will have a bugs there!!! (This is the
>>> place where detach could occurred)
>>>
>>> Mark, Is it acceptable for you ?
>>>
>>> Eike, can we change the internal API for a maintenance stream ?
>>> We will only need to add CDOTRansactionImpl.detachObject().
>>>
>>>
>>> Simon
>>>
>>>
>>> Eike Stepper wrote:
>>>> Mark,
>>>>
>>>> I fear that detaching objects from the persistent object graph is
>>>> known to be a missing feature in the 1.0 version ;-(
>>>> We were not able to complete this feature before Ganymede and I
>>>> think it won't be possible to add it in the manitenance stream due
>>>> to required API changes that would make the fix binary incompatible.
>>>> Since Simon implemented this feature in the 2.0 stream I will
>>>> discuss this issue with him. Let's see what he thinks...
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>> ----
>>>> http://thegordian.blogspot.com
>>>>
>>>>
>>>>
>>>> Mark Geib schrieb:
>>>>> I am running CDO/NET4J 1.0.4 on Linux, Eclipse 3.4.1.
>>>>>
>>>>> I seem to not be able to remove an object from my model, which is
>>>>> CDO backed. The object I am trying to remove is in the 'middle' of
>>>>> a containment tree. That is, the object I am removing contains
>>>>> other object which in turn contain other objects, etc. Also, the
>>>>> containment tree includes collections that are in a hashmap.
>>>>>
>>>>> Doing some trial and error it seems that I can't do any remove on
>>>>> the repository at all with the resulting NPE.
>>>>>
>>>>> Exception in thread "main" java.lang.NullPointerException
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:447)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:1)
>>>>>
>>>>> at
>>>>> org.eclipse.net4j.util.fsm.FiniteStateMachine.process(Finite StateMachine.java:161)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.CDOStateMachine.commit(CDOState Machine.java:275)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.CDOTransactionImpl.postCommit(C DOTransactionImpl.java:487)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.CDOTransactionImpl.commit(CDOTr ansactionImpl.java:251)
>>>>>
>>>>> at dm.util.DmModelManager.save(DmModelManager.java:189)
>>>>> at cse.dm.modelManager.Dm522.removeSectionContents(Dm522.java:3 27)
Re: [CDO] NPE when removing an object in containment tree [message #425558 is a reply to message #425556] Mon, 01 December 2008 16:02 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Mark,

Thanks for your patience with us!

What exactly do you mean by "signature"? Position in a list?
I think your "trashcan" approach *could* work. But I'm not sure! Would
youlike to try it before we discuss options that would require way more
effort?

Cheers
/Eike

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



Mark Geib schrieb:
> Eike/Simon/Vik,
>
> Thanks for the responses, but not the news...
>
> I am not sure it is possible for us to switch to the new 2.0 at this
> point. That I assume would require us to move to Eclipse 3.5 ...EMF...??
>
> The bigger problem we have is that this new system absolutely depends
> on be able to delete an existing object, and all that it contains, and
> then replacing with a new object, and containment tree, that has the
> same 'signature' as the old object in our system. I assume that the it
> is the remove of the object from a list that is not supported, so we
> could not just change the containment to a 'trashCan' object to handle
> latter..?
>
> I will also discuss with my team.
>
> Mark.
>
>
>
> Eike Stepper wrote:
>> Simon McDuff schrieb:
>>> Oh yeah forgot also to mentionned the following:
>>> This can lead us to modify many things :
>>>
>>> - depopulation a CDOObject.. We fixed some issue there.
>>> - Introducing the cdoSettings...
>>>
>>> Mark, the objects you wanted to detach.. do you want to reuse them
>>> in another context. If you say no, we could remove completely the
>>> detach even in the state machine!! SO this objects, even if it is
>>> not link... will not occurred a NPE.
>>>
>>> What do you think Eike ? (To remove only the even in the State machine)
>> Hmm, I fear that we open Pandora's box when we try to address this
>> issue in the maintenance stream ;-(
>> In the end we are likely to run against the "binary compatibility wall".
>>
>> Mark, doy ou see a way to switch to the 2.0 integration builds already?
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://thegordian.blogspot.com
>>
>>
>>>
>>> Otherwise it could lead us to many many modifications!!
>>>
>>> Simon
>>>
>>> Simon McDuff wrote:
>>>> Hi Mark and Eike,
>>>>
>>>> Detach feature was introduced in 2.0. (Nothing new.. Eike already
>>>> mentionned it)
>>>>
>>>> However, without implementing this features we could make sure that
>>>> the exception do not occurred.. but objects will not be removed
>>>> from your persistence layer(back-end) even if it is not referenced
>>>> by any objects. The exception will not occurred and your data will
>>>> behave as you expect.
>>>> It is possible that we had some bugs in the way we handle
>>>> containment relationship.... so maybe we will have a bugs there!!!
>>>> (This is the place where detach could occurred)
>>>>
>>>> Mark, Is it acceptable for you ?
>>>>
>>>> Eike, can we change the internal API for a maintenance stream ?
>>>> We will only need to add CDOTRansactionImpl.detachObject().
>>>>
>>>>
>>>> Simon
>>>>
>>>>
>>>> Eike Stepper wrote:
>>>>> Mark,
>>>>>
>>>>> I fear that detaching objects from the persistent object graph is
>>>>> known to be a missing feature in the 1.0 version ;-(
>>>>> We were not able to complete this feature before Ganymede and I
>>>>> think it won't be possible to add it in the manitenance stream due
>>>>> to required API changes that would make the fix binary
>>>>> incompatible. Since Simon implemented this feature in the 2.0
>>>>> stream I will discuss this issue with him. Let's see what he
>>>>> thinks...
>>>>>
>>>>> Cheers
>>>>> /Eike
>>>>>
>>>>> ----
>>>>> http://thegordian.blogspot.com
>>>>>
>>>>>
>>>>>
>>>>> Mark Geib schrieb:
>>>>>> I am running CDO/NET4J 1.0.4 on Linux, Eclipse 3.4.1.
>>>>>>
>>>>>> I seem to not be able to remove an object from my model, which is
>>>>>> CDO backed. The object I am trying to remove is in the 'middle'
>>>>>> of a containment tree. That is, the object I am removing contains
>>>>>> other object which in turn contain other objects, etc. Also, the
>>>>>> containment tree includes collections that are in a hashmap.
>>>>>>
>>>>>> Doing some trial and error it seems that I can't do any remove on
>>>>>> the repository at all with the resulting NPE.
>>>>>>
>>>>>> Exception in thread "main" java.lang.NullPointerException
>>>>>> at
>>>>>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:447)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:1)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.net4j.util.fsm.FiniteStateMachine.process(Finite StateMachine.java:161)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.internal.cdo.CDOStateMachine.commit(CDOState Machine.java:275)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.internal.cdo.CDOTransactionImpl.postCommit(C DOTransactionImpl.java:487)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.internal.cdo.CDOTransactionImpl.commit(CDOTr ansactionImpl.java:251)
>>>>>>
>>>>>> at dm.util.DmModelManager.save(DmModelManager.java:189)
>>>>>> at
>>>>>> cse.dm.modelManager.Dm522.removeSectionContents(Dm522.java:3 27)


Re: [CDO] NPE when removing an object in containment tree [message #425560 is a reply to message #425558] Mon, 01 December 2008 16:15 Go to previous messageGo to next message
Mark Geib is currently offline Mark GeibFriend
Messages: 432
Registered: July 2009
Senior Member
Eike,

The object that I am trying to prune contains say three attributes that
uniquely identify the object, and it's containment tree. One of these
attributes is sort of a version. So, when the version changes I need to
delete or prune this object and rebuild it and all the objects it
contains. However, I can not leave the old object in it's original
container, because of the way other clients work. So, if I could change
it's containing object to a 'trashcan' it would not be 'visible' to
these other clients. BUT, to do that I need to be able to 'remove' it
from the original container before I add it to the trashcan. Will that
work.?? That is where I get the NPE now I think.

Or is it the case that by adding it to another container that it is not
marked to be detached..?

Mark.



Eike Stepper wrote:
> Mark,
>
> Thanks for your patience with us!
>
> What exactly do you mean by "signature"? Position in a list?
> I think your "trashcan" approach *could* work. But I'm not sure! Would
> youlike to try it before we discuss options that would require way more
> effort?
>
> Cheers
> /Eike
>
> ----
> http://thegordian.blogspot.com
>
>
>
> Mark Geib schrieb:
>> Eike/Simon/Vik,
>>
>> Thanks for the responses, but not the news...
>>
>> I am not sure it is possible for us to switch to the new 2.0 at this
>> point. That I assume would require us to move to Eclipse 3.5 ...EMF...??
>>
>> The bigger problem we have is that this new system absolutely depends
>> on be able to delete an existing object, and all that it contains, and
>> then replacing with a new object, and containment tree, that has the
>> same 'signature' as the old object in our system. I assume that the it
>> is the remove of the object from a list that is not supported, so we
>> could not just change the containment to a 'trashCan' object to handle
>> latter..?
>>
>> I will also discuss with my team.
>>
>> Mark.
>>
>>
>>
>> Eike Stepper wrote:
>>> Simon McDuff schrieb:
>>>> Oh yeah forgot also to mentionned the following:
>>>> This can lead us to modify many things :
>>>>
>>>> - depopulation a CDOObject.. We fixed some issue there.
>>>> - Introducing the cdoSettings...
>>>>
>>>> Mark, the objects you wanted to detach.. do you want to reuse them
>>>> in another context. If you say no, we could remove completely the
>>>> detach even in the state machine!! SO this objects, even if it is
>>>> not link... will not occurred a NPE.
>>>>
>>>> What do you think Eike ? (To remove only the even in the State machine)
>>> Hmm, I fear that we open Pandora's box when we try to address this
>>> issue in the maintenance stream ;-(
>>> In the end we are likely to run against the "binary compatibility wall".
>>>
>>> Mark, doy ou see a way to switch to the 2.0 integration builds already?
>>>
>>> Cheers
>>> /Eike
>>>
>>> ----
>>> http://thegordian.blogspot.com
>>>
>>>
>>>>
>>>> Otherwise it could lead us to many many modifications!!
>>>>
>>>> Simon
>>>>
>>>> Simon McDuff wrote:
>>>>> Hi Mark and Eike,
>>>>>
>>>>> Detach feature was introduced in 2.0. (Nothing new.. Eike already
>>>>> mentionned it)
>>>>>
>>>>> However, without implementing this features we could make sure that
>>>>> the exception do not occurred.. but objects will not be removed
>>>>> from your persistence layer(back-end) even if it is not referenced
>>>>> by any objects. The exception will not occurred and your data will
>>>>> behave as you expect.
>>>>> It is possible that we had some bugs in the way we handle
>>>>> containment relationship.... so maybe we will have a bugs there!!!
>>>>> (This is the place where detach could occurred)
>>>>>
>>>>> Mark, Is it acceptable for you ?
>>>>>
>>>>> Eike, can we change the internal API for a maintenance stream ?
>>>>> We will only need to add CDOTRansactionImpl.detachObject().
>>>>>
>>>>>
>>>>> Simon
>>>>>
>>>>>
>>>>> Eike Stepper wrote:
>>>>>> Mark,
>>>>>>
>>>>>> I fear that detaching objects from the persistent object graph is
>>>>>> known to be a missing feature in the 1.0 version ;-(
>>>>>> We were not able to complete this feature before Ganymede and I
>>>>>> think it won't be possible to add it in the manitenance stream due
>>>>>> to required API changes that would make the fix binary
>>>>>> incompatible. Since Simon implemented this feature in the 2.0
>>>>>> stream I will discuss this issue with him. Let's see what he
>>>>>> thinks...
>>>>>>
>>>>>> Cheers
>>>>>> /Eike
>>>>>>
>>>>>> ----
>>>>>> http://thegordian.blogspot.com
>>>>>>
>>>>>>
>>>>>>
>>>>>> Mark Geib schrieb:
>>>>>>> I am running CDO/NET4J 1.0.4 on Linux, Eclipse 3.4.1.
>>>>>>>
>>>>>>> I seem to not be able to remove an object from my model, which is
>>>>>>> CDO backed. The object I am trying to remove is in the 'middle'
>>>>>>> of a containment tree. That is, the object I am removing contains
>>>>>>> other object which in turn contain other objects, etc. Also, the
>>>>>>> containment tree includes collections that are in a hashmap.
>>>>>>>
>>>>>>> Doing some trial and error it seems that I can't do any remove on
>>>>>>> the repository at all with the resulting NPE.
>>>>>>>
>>>>>>> Exception in thread "main" java.lang.NullPointerException
>>>>>>> at
>>>>>>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:447)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:1)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.net4j.util.fsm.FiniteStateMachine.process(Finite StateMachine.java:161)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.internal.cdo.CDOStateMachine.commit(CDOState Machine.java:275)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.internal.cdo.CDOTransactionImpl.postCommit(C DOTransactionImpl.java:487)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.internal.cdo.CDOTransactionImpl.commit(CDOTr ansactionImpl.java:251)
>>>>>>>
>>>>>>> at dm.util.DmModelManager.save(DmModelManager.java:189)
>>>>>>> at
>>>>>>> cse.dm.modelManager.Dm522.removeSectionContents(Dm522.java:3 27)
Re: [CDO] NPE when removing an object in containment tree [message #425562 is a reply to message #425560] Mon, 01 December 2008 16:22 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Mark Geib schrieb:
> Eike,
>
> The object that I am trying to prune contains say three attributes
> that uniquely identify the object, and it's containment tree. One of
> these attributes is sort of a version. So, when the version changes I
> need to delete or prune this object and rebuild it and all the objects
> it contains. However, I can not leave the old object in it's original
> container, because of the way other clients work. So, if I could
> change it's containing object to a 'trashcan' it would not be
> 'visible' to these other clients. BUT, to do that I need to be able to
> 'remove' it from the original container before I add it to the
> trashcan. Will that work.?? That is where I get the NPE now I think.
>
> Or is it the case that by adding it to another container that it is
> not marked to be detached..?
That's what I had in mind when I said "could work" ;-)
Even if that does not work immediately we could make that (i.e. move)
work more easily than real detachment.
Could you try it?

Cheers
/Eike

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


>
> Mark.
>
>
>
> Eike Stepper wrote:
>> Mark,
>>
>> Thanks for your patience with us!
>>
>> What exactly do you mean by "signature"? Position in a list?
>> I think your "trashcan" approach *could* work. But I'm not sure!
>> Would youlike to try it before we discuss options that would require
>> way more effort?
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://thegordian.blogspot.com
>>
>>
>>
>> Mark Geib schrieb:
>>> Eike/Simon/Vik,
>>>
>>> Thanks for the responses, but not the news...
>>>
>>> I am not sure it is possible for us to switch to the new 2.0 at this
>>> point. That I assume would require us to move to Eclipse 3.5
>>> ...EMF...??
>>>
>>> The bigger problem we have is that this new system absolutely
>>> depends on be able to delete an existing object, and all that it
>>> contains, and then replacing with a new object, and containment
>>> tree, that has the same 'signature' as the old object in our system.
>>> I assume that the it is the remove of the object from a list that is
>>> not supported, so we could not just change the containment to a
>>> 'trashCan' object to handle latter..?
>>>
>>> I will also discuss with my team.
>>>
>>> Mark.
>>>
>>>
>>>
>>> Eike Stepper wrote:
>>>> Simon McDuff schrieb:
>>>>> Oh yeah forgot also to mentionned the following:
>>>>> This can lead us to modify many things :
>>>>>
>>>>> - depopulation a CDOObject.. We fixed some issue there.
>>>>> - Introducing the cdoSettings...
>>>>>
>>>>> Mark, the objects you wanted to detach.. do you want to reuse them
>>>>> in another context. If you say no, we could remove completely the
>>>>> detach even in the state machine!! SO this objects, even if it is
>>>>> not link... will not occurred a NPE.
>>>>>
>>>>> What do you think Eike ? (To remove only the even in the State
>>>>> machine)
>>>> Hmm, I fear that we open Pandora's box when we try to address this
>>>> issue in the maintenance stream ;-(
>>>> In the end we are likely to run against the "binary compatibility
>>>> wall".
>>>>
>>>> Mark, doy ou see a way to switch to the 2.0 integration builds
>>>> already?
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>> ----
>>>> http://thegordian.blogspot.com
>>>>
>>>>
>>>>>
>>>>> Otherwise it could lead us to many many modifications!!
>>>>>
>>>>> Simon
>>>>>
>>>>> Simon McDuff wrote:
>>>>>> Hi Mark and Eike,
>>>>>>
>>>>>> Detach feature was introduced in 2.0. (Nothing new.. Eike already
>>>>>> mentionned it)
>>>>>>
>>>>>> However, without implementing this features we could make sure
>>>>>> that the exception do not occurred.. but objects will not be
>>>>>> removed from your persistence layer(back-end) even if it is not
>>>>>> referenced by any objects. The exception will not occurred and
>>>>>> your data will behave as you expect.
>>>>>> It is possible that we had some bugs in the way we handle
>>>>>> containment relationship.... so maybe we will have a bugs
>>>>>> there!!! (This is the place where detach could occurred)
>>>>>>
>>>>>> Mark, Is it acceptable for you ?
>>>>>>
>>>>>> Eike, can we change the internal API for a maintenance stream ?
>>>>>> We will only need to add CDOTRansactionImpl.detachObject().
>>>>>>
>>>>>>
>>>>>> Simon
>>>>>>
>>>>>>
>>>>>> Eike Stepper wrote:
>>>>>>> Mark,
>>>>>>>
>>>>>>> I fear that detaching objects from the persistent object graph
>>>>>>> is known to be a missing feature in the 1.0 version ;-(
>>>>>>> We were not able to complete this feature before Ganymede and I
>>>>>>> think it won't be possible to add it in the manitenance stream
>>>>>>> due to required API changes that would make the fix binary
>>>>>>> incompatible. Since Simon implemented this feature in the 2.0
>>>>>>> stream I will discuss this issue with him. Let's see what he
>>>>>>> thinks...
>>>>>>>
>>>>>>> Cheers
>>>>>>> /Eike
>>>>>>>
>>>>>>> ----
>>>>>>> http://thegordian.blogspot.com
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Mark Geib schrieb:
>>>>>>>> I am running CDO/NET4J 1.0.4 on Linux, Eclipse 3.4.1.
>>>>>>>>
>>>>>>>> I seem to not be able to remove an object from my model, which
>>>>>>>> is CDO backed. The object I am trying to remove is in the
>>>>>>>> 'middle' of a containment tree. That is, the object I am
>>>>>>>> removing contains other object which in turn contain other
>>>>>>>> objects, etc. Also, the containment tree includes collections
>>>>>>>> that are in a hashmap.
>>>>>>>>
>>>>>>>> Doing some trial and error it seems that I can't do any remove
>>>>>>>> on the repository at all with the resulting NPE.
>>>>>>>>
>>>>>>>> Exception in thread "main" java.lang.NullPointerException
>>>>>>>> at
>>>>>>>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:447)
>>>>>>>>
>>>>>>>> at
>>>>>>>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:1)
>>>>>>>>
>>>>>>>> at
>>>>>>>> org.eclipse.net4j.util.fsm.FiniteStateMachine.process(Finite StateMachine.java:161)
>>>>>>>>
>>>>>>>> at
>>>>>>>> org.eclipse.emf.internal.cdo.CDOStateMachine.commit(CDOState Machine.java:275)
>>>>>>>>
>>>>>>>> at
>>>>>>>> org.eclipse.emf.internal.cdo.CDOTransactionImpl.postCommit(C DOTransactionImpl.java:487)
>>>>>>>>
>>>>>>>> at
>>>>>>>> org.eclipse.emf.internal.cdo.CDOTransactionImpl.commit(CDOTr ansactionImpl.java:251)
>>>>>>>>
>>>>>>>> at dm.util.DmModelManager.save(DmModelManager.java:189)
>>>>>>>> at
>>>>>>>> cse.dm.modelManager.Dm522.removeSectionContents(Dm522.java:3 27)


Re: [CDO] NPE when removing an object in containment tree [message #425563 is a reply to message #425562] Mon, 01 December 2008 16:26 Go to previous messageGo to next message
Mark Geib is currently offline Mark GeibFriend
Messages: 432
Registered: July 2009
Senior Member
Eike,

Working on it now... I will post back when I have results.

Mark.

Eike Stepper wrote:
> Mark Geib schrieb:
>> Eike,
>>
>> The object that I am trying to prune contains say three attributes
>> that uniquely identify the object, and it's containment tree. One of
>> these attributes is sort of a version. So, when the version changes I
>> need to delete or prune this object and rebuild it and all the objects
>> it contains. However, I can not leave the old object in it's original
>> container, because of the way other clients work. So, if I could
>> change it's containing object to a 'trashcan' it would not be
>> 'visible' to these other clients. BUT, to do that I need to be able to
>> 'remove' it from the original container before I add it to the
>> trashcan. Will that work.?? That is where I get the NPE now I think.
>>
>> Or is it the case that by adding it to another container that it is
>> not marked to be detached..?
> That's what I had in mind when I said "could work" ;-)
> Even if that does not work immediately we could make that (i.e. move)
> work more easily than real detachment.
> Could you try it?
>
> Cheers
> /Eike
>
> ----
> http://thegordian.blogspot.com
>
>
>>
>> Mark.
>>
>>
>>
>> Eike Stepper wrote:
>>> Mark,
>>>
>>> Thanks for your patience with us!
>>>
>>> What exactly do you mean by "signature"? Position in a list?
>>> I think your "trashcan" approach *could* work. But I'm not sure!
>>> Would youlike to try it before we discuss options that would require
>>> way more effort?
>>>
>>> Cheers
>>> /Eike
>>>
>>> ----
>>> http://thegordian.blogspot.com
>>>
>>>
>>>
>>> Mark Geib schrieb:
>>>> Eike/Simon/Vik,
>>>>
>>>> Thanks for the responses, but not the news...
>>>>
>>>> I am not sure it is possible for us to switch to the new 2.0 at this
>>>> point. That I assume would require us to move to Eclipse 3.5
>>>> ...EMF...??
>>>>
>>>> The bigger problem we have is that this new system absolutely
>>>> depends on be able to delete an existing object, and all that it
>>>> contains, and then replacing with a new object, and containment
>>>> tree, that has the same 'signature' as the old object in our system.
>>>> I assume that the it is the remove of the object from a list that is
>>>> not supported, so we could not just change the containment to a
>>>> 'trashCan' object to handle latter..?
>>>>
>>>> I will also discuss with my team.
>>>>
>>>> Mark.
>>>>
>>>>
>>>>
>>>> Eike Stepper wrote:
>>>>> Simon McDuff schrieb:
>>>>>> Oh yeah forgot also to mentionned the following:
>>>>>> This can lead us to modify many things :
>>>>>>
>>>>>> - depopulation a CDOObject.. We fixed some issue there.
>>>>>> - Introducing the cdoSettings...
>>>>>>
>>>>>> Mark, the objects you wanted to detach.. do you want to reuse them
>>>>>> in another context. If you say no, we could remove completely the
>>>>>> detach even in the state machine!! SO this objects, even if it is
>>>>>> not link... will not occurred a NPE.
>>>>>>
>>>>>> What do you think Eike ? (To remove only the even in the State
>>>>>> machine)
>>>>> Hmm, I fear that we open Pandora's box when we try to address this
>>>>> issue in the maintenance stream ;-(
>>>>> In the end we are likely to run against the "binary compatibility
>>>>> wall".
>>>>>
>>>>> Mark, doy ou see a way to switch to the 2.0 integration builds
>>>>> already?
>>>>>
>>>>> Cheers
>>>>> /Eike
>>>>>
>>>>> ----
>>>>> http://thegordian.blogspot.com
>>>>>
>>>>>
>>>>>>
>>>>>> Otherwise it could lead us to many many modifications!!
>>>>>>
>>>>>> Simon
>>>>>>
>>>>>> Simon McDuff wrote:
>>>>>>> Hi Mark and Eike,
>>>>>>>
>>>>>>> Detach feature was introduced in 2.0. (Nothing new.. Eike already
>>>>>>> mentionned it)
>>>>>>>
>>>>>>> However, without implementing this features we could make sure
>>>>>>> that the exception do not occurred.. but objects will not be
>>>>>>> removed from your persistence layer(back-end) even if it is not
>>>>>>> referenced by any objects. The exception will not occurred and
>>>>>>> your data will behave as you expect.
>>>>>>> It is possible that we had some bugs in the way we handle
>>>>>>> containment relationship.... so maybe we will have a bugs
>>>>>>> there!!! (This is the place where detach could occurred)
>>>>>>>
>>>>>>> Mark, Is it acceptable for you ?
>>>>>>>
>>>>>>> Eike, can we change the internal API for a maintenance stream ?
>>>>>>> We will only need to add CDOTRansactionImpl.detachObject().
>>>>>>>
>>>>>>>
>>>>>>> Simon
>>>>>>>
>>>>>>>
>>>>>>> Eike Stepper wrote:
>>>>>>>> Mark,
>>>>>>>>
>>>>>>>> I fear that detaching objects from the persistent object graph
>>>>>>>> is known to be a missing feature in the 1.0 version ;-(
>>>>>>>> We were not able to complete this feature before Ganymede and I
>>>>>>>> think it won't be possible to add it in the manitenance stream
>>>>>>>> due to required API changes that would make the fix binary
>>>>>>>> incompatible. Since Simon implemented this feature in the 2.0
>>>>>>>> stream I will discuss this issue with him. Let's see what he
>>>>>>>> thinks...
>>>>>>>>
>>>>>>>> Cheers
>>>>>>>> /Eike
>>>>>>>>
>>>>>>>> ----
>>>>>>>> http://thegordian.blogspot.com
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Mark Geib schrieb:
>>>>>>>>> I am running CDO/NET4J 1.0.4 on Linux, Eclipse 3.4.1.
>>>>>>>>>
>>>>>>>>> I seem to not be able to remove an object from my model, which
>>>>>>>>> is CDO backed. The object I am trying to remove is in the
>>>>>>>>> 'middle' of a containment tree. That is, the object I am
>>>>>>>>> removing contains other object which in turn contain other
>>>>>>>>> objects, etc. Also, the containment tree includes collections
>>>>>>>>> that are in a hashmap.
>>>>>>>>>
>>>>>>>>> Doing some trial and error it seems that I can't do any remove
>>>>>>>>> on the repository at all with the resulting NPE.
>>>>>>>>>
>>>>>>>>> Exception in thread "main" java.lang.NullPointerException
>>>>>>>>> at
>>>>>>>>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:447)
>>>>>>>>>
>>>>>>>>> at
>>>>>>>>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:1)
>>>>>>>>>
>>>>>>>>> at
>>>>>>>>> org.eclipse.net4j.util.fsm.FiniteStateMachine.process(Finite StateMachine.java:161)
>>>>>>>>>
>>>>>>>>> at
>>>>>>>>> org.eclipse.emf.internal.cdo.CDOStateMachine.commit(CDOState Machine.java:275)
>>>>>>>>>
>>>>>>>>> at
>>>>>>>>> org.eclipse.emf.internal.cdo.CDOTransactionImpl.postCommit(C DOTransactionImpl.java:487)
>>>>>>>>>
>>>>>>>>> at
>>>>>>>>> org.eclipse.emf.internal.cdo.CDOTransactionImpl.commit(CDOTr ansactionImpl.java:251)
>>>>>>>>>
>>>>>>>>> at dm.util.DmModelManager.save(DmModelManager.java:189)
>>>>>>>>> at
>>>>>>>>> cse.dm.modelManager.Dm522.removeSectionContents(Dm522.java:3 27)
Re: [CDO] NPE when removing an object in containment tree--workaround [message #425570 is a reply to message #425563] Mon, 01 December 2008 17:42 Go to previous message
Mark Geib is currently offline Mark GeibFriend
Messages: 432
Registered: July 2009
Senior Member
Eike,

The trashcan worked.

To make it work you must add the object to the trashcan prior to
removing it from the original containing object.

I can get by, for now...

Mark.



Mark Geib wrote:
> Eike,
>
> Working on it now... I will post back when I have results.
>
> Mark.
>
> Eike Stepper wrote:
>> Mark Geib schrieb:
>>> Eike,
>>>
>>> The object that I am trying to prune contains say three attributes
>>> that uniquely identify the object, and it's containment tree. One of
>>> these attributes is sort of a version. So, when the version changes I
>>> need to delete or prune this object and rebuild it and all the
>>> objects it contains. However, I can not leave the old object in it's
>>> original container, because of the way other clients work. So, if I
>>> could change it's containing object to a 'trashcan' it would not be
>>> 'visible' to these other clients. BUT, to do that I need to be able
>>> to 'remove' it from the original container before I add it to the
>>> trashcan. Will that work.?? That is where I get the NPE now I think.
>>>
>>> Or is it the case that by adding it to another container that it is
>>> not marked to be detached..?
>> That's what I had in mind when I said "could work" ;-)
>> Even if that does not work immediately we could make that (i.e. move)
>> work more easily than real detachment.
>> Could you try it?
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://thegordian.blogspot.com
>>
>>
>>>
>>> Mark.
>>>
>>>
>>>
>>> Eike Stepper wrote:
>>>> Mark,
>>>>
>>>> Thanks for your patience with us!
>>>>
>>>> What exactly do you mean by "signature"? Position in a list?
>>>> I think your "trashcan" approach *could* work. But I'm not sure!
>>>> Would youlike to try it before we discuss options that would require
>>>> way more effort?
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>> ----
>>>> http://thegordian.blogspot.com
>>>>
>>>>
>>>>
>>>> Mark Geib schrieb:
>>>>> Eike/Simon/Vik,
>>>>>
>>>>> Thanks for the responses, but not the news...
>>>>>
>>>>> I am not sure it is possible for us to switch to the new 2.0 at
>>>>> this point. That I assume would require us to move to Eclipse 3.5
>>>>> ...EMF...??
>>>>>
>>>>> The bigger problem we have is that this new system absolutely
>>>>> depends on be able to delete an existing object, and all that it
>>>>> contains, and then replacing with a new object, and containment
>>>>> tree, that has the same 'signature' as the old object in our
>>>>> system. I assume that the it is the remove of the object from a
>>>>> list that is not supported, so we could not just change the
>>>>> containment to a 'trashCan' object to handle latter..?
>>>>>
>>>>> I will also discuss with my team.
>>>>>
>>>>> Mark.
>>>>>
>>>>>
>>>>>
>>>>> Eike Stepper wrote:
>>>>>> Simon McDuff schrieb:
>>>>>>> Oh yeah forgot also to mentionned the following:
>>>>>>> This can lead us to modify many things :
>>>>>>>
>>>>>>> - depopulation a CDOObject.. We fixed some issue there.
>>>>>>> - Introducing the cdoSettings...
>>>>>>>
>>>>>>> Mark, the objects you wanted to detach.. do you want to reuse
>>>>>>> them in another context. If you say no, we could remove
>>>>>>> completely the detach even in the state machine!! SO this
>>>>>>> objects, even if it is not link... will not occurred a NPE.
>>>>>>>
>>>>>>> What do you think Eike ? (To remove only the even in the State
>>>>>>> machine)
>>>>>> Hmm, I fear that we open Pandora's box when we try to address this
>>>>>> issue in the maintenance stream ;-(
>>>>>> In the end we are likely to run against the "binary compatibility
>>>>>> wall".
>>>>>>
>>>>>> Mark, doy ou see a way to switch to the 2.0 integration builds
>>>>>> already?
>>>>>>
>>>>>> Cheers
>>>>>> /Eike
>>>>>>
>>>>>> ----
>>>>>> http://thegordian.blogspot.com
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> Otherwise it could lead us to many many modifications!!
>>>>>>>
>>>>>>> Simon
>>>>>>>
>>>>>>> Simon McDuff wrote:
>>>>>>>> Hi Mark and Eike,
>>>>>>>>
>>>>>>>> Detach feature was introduced in 2.0. (Nothing new.. Eike
>>>>>>>> already mentionned it)
>>>>>>>>
>>>>>>>> However, without implementing this features we could make sure
>>>>>>>> that the exception do not occurred.. but objects will not be
>>>>>>>> removed from your persistence layer(back-end) even if it is not
>>>>>>>> referenced by any objects. The exception will not occurred and
>>>>>>>> your data will behave as you expect.
>>>>>>>> It is possible that we had some bugs in the way we handle
>>>>>>>> containment relationship.... so maybe we will have a bugs
>>>>>>>> there!!! (This is the place where detach could occurred)
>>>>>>>>
>>>>>>>> Mark, Is it acceptable for you ?
>>>>>>>>
>>>>>>>> Eike, can we change the internal API for a maintenance stream ?
>>>>>>>> We will only need to add CDOTRansactionImpl.detachObject().
>>>>>>>>
>>>>>>>>
>>>>>>>> Simon
>>>>>>>>
>>>>>>>>
>>>>>>>> Eike Stepper wrote:
>>>>>>>>> Mark,
>>>>>>>>>
>>>>>>>>> I fear that detaching objects from the persistent object graph
>>>>>>>>> is known to be a missing feature in the 1.0 version ;-(
>>>>>>>>> We were not able to complete this feature before Ganymede and I
>>>>>>>>> think it won't be possible to add it in the manitenance stream
>>>>>>>>> due to required API changes that would make the fix binary
>>>>>>>>> incompatible. Since Simon implemented this feature in the 2.0
>>>>>>>>> stream I will discuss this issue with him. Let's see what he
>>>>>>>>> thinks...
>>>>>>>>>
>>>>>>>>> Cheers
>>>>>>>>> /Eike
>>>>>>>>>
>>>>>>>>> ----
>>>>>>>>> http://thegordian.blogspot.com
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Mark Geib schrieb:
>>>>>>>>>> I am running CDO/NET4J 1.0.4 on Linux, Eclipse 3.4.1.
>>>>>>>>>>
>>>>>>>>>> I seem to not be able to remove an object from my model, which
>>>>>>>>>> is CDO backed. The object I am trying to remove is in the
>>>>>>>>>> 'middle' of a containment tree. That is, the object I am
>>>>>>>>>> removing contains other object which in turn contain other
>>>>>>>>>> objects, etc. Also, the containment tree includes collections
>>>>>>>>>> that are in a hashmap.
>>>>>>>>>>
>>>>>>>>>> Doing some trial and error it seems that I can't do any remove
>>>>>>>>>> on the repository at all with the resulting NPE.
>>>>>>>>>>
>>>>>>>>>> Exception in thread "main" java.lang.NullPointerException
>>>>>>>>>> at
>>>>>>>>>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:447)
>>>>>>>>>>
>>>>>>>>>> at
>>>>>>>>>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:1)
>>>>>>>>>>
>>>>>>>>>> at
>>>>>>>>>> org.eclipse.net4j.util.fsm.FiniteStateMachine.process(Finite StateMachine.java:161)
>>>>>>>>>>
>>>>>>>>>> at
>>>>>>>>>> org.eclipse.emf.internal.cdo.CDOStateMachine.commit(CDOState Machine.java:275)
>>>>>>>>>>
>>>>>>>>>> at
>>>>>>>>>> org.eclipse.emf.internal.cdo.CDOTransactionImpl.postCommit(C DOTransactionImpl.java:487)
>>>>>>>>>>
>>>>>>>>>> at
>>>>>>>>>> org.eclipse.emf.internal.cdo.CDOTransactionImpl.commit(CDOTr ansactionImpl.java:251)
>>>>>>>>>>
>>>>>>>>>> at dm.util.DmModelManager.save(DmModelManager.java:189)
>>>>>>>>>> at
>>>>>>>>>> cse.dm.modelManager.Dm522.removeSectionContents(Dm522.java:3 27)
Previous Topic:createXXX parameters in Factories
Next Topic:Fetching a CDO object by CDOID
Goto Forum:
  


Current Time: Fri Mar 29 15:25:54 GMT 2024

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

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

Back to the top