Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO?] Notifications when reference is set to 'null'
[CDO?] Notifications when reference is set to 'null' [message #1235099] Thu, 23 January 2014 15:24 Go to next message
Jon Doe is currently offline Jon DoeFriend
Messages: 7
Registered: June 2012
Junior Member
Hello,

having classes 'A' and 'B', with 'A.b' referencing/containing instances
of 'B', I stumbled over the following oddity when setting 'A.b' to null:

Other "local" views and transactions [from same CDOSession] do *not* get
notified when 'A.b' is set to 'null', but they get notified when the
reference is changed to another instance of 'B'.

In other clients ["remote"], changes are visible immediately --
regardless if 'A.b' is set to 'null' or another instance of 'B'.
(So the client which sets to 'null' does NOT reflect the changes, but
all other clients do so)


On the one hand I might have overseen something obvious to those who
know what they're doing, on the other hand I'm a bit confused why things
work for "remote" clients as expectedly.


In short:
EMFObservables.observeValue((A) instance, (EReference) bReference);

(Value)ChangeListeners fire for local modifications != 'null', and all
remote modifications regardless of value.


Now I feel lost -- thanks in advance.
Re: [CDO] Notifications when reference is set to 'null' (#367738?) [message #1235626 is a reply to message #1235099] Fri, 24 January 2014 20:59 Go to previous messageGo to next message
Jon Doe is currently offline Jon DoeFriend
Messages: 7
Registered: June 2012
Junior Member
Looking deeper into the matter, something seems to be wrong with
'oldValue's of Notifications.

Btw, this is Eclipse 4.3.1 with CDO 4.2 20130918 on Linux.

As mentioned, my application (= e.g. bound Viewers..) does not react on
the "local" change of a reference to value 'null'. Viewers and listeners
react on changing references to *other* (non-null) values, and they
react on changes to value 'null' when the change was committed from
another session(sic).

Bug 367738, result of ~2 years old thread "[CDO]
Notification#getOldValue always null?", was apparently closed to sudden
lack of any interest.
[ https://bugs.eclipse.org/bugs/show_bug.cgi?id=367738 ]

According to that thread, the original poster encountered unexpected
'oldValue's valued 'null'.

My problem also seems to be related to getting unexpected 'oldValue's of
value 'null'".

My (local) Viewers do not react, because method "isTouch", in class
org.eclipse.emf.common.notify.impl.NotificationImpl for event-types
(non-primitive-)SET and UNSET returns:

oldValue == null ? newValue == null : oldValue.equals(newValue)


In my case (local change), and --probably same issue as for the creator
of bug 367738--, 'oldValue' is (incorrectly? but always) null, so when
newValue [UNSET/SET value 'null'] is 'null', too - local Viewers will
not update.


--
For me personally I hacked kindof

if type==UNSET then oldValue=new Object()

into org.eclipse.emf.internal.cdo.object.CDONotificationBuilder to fool
this rule, and .. I do get my updates.
--


I personally am too new to all this to dare to call this a bug, but when
changing a reference from "anything non-null" to "null", or when
unsetting a reference, oldValue should not be null.

Let me know if this is by intention and how to safely work around in
that case.




On 23.01.2014 16:24, Jon Doe wrote:
> Hello,
>
> having classes 'A' and 'B', with 'A.b' referencing/containing instances
> of 'B', I stumbled over the following oddity when setting 'A.b' to null:
>
> Other "local" views and transactions [from same CDOSession] do *not* get
> notified when 'A.b' is set to 'null', but they get notified when the
> reference is changed to another instance of 'B'.
>
> In other clients ["remote"], changes are visible immediately --
> regardless if 'A.b' is set to 'null' or another instance of 'B'.
> (So the client which sets to 'null' does NOT reflect the changes, but
> all other clients do so)
>
>
> On the one hand I might have overseen something obvious to those who
> know what they're doing, on the other hand I'm a bit confused why things
> work for "remote" clients as expectedly.
>
>
> In short:
> EMFObservables.observeValue((A) instance, (EReference) bReference);
>
> (Value)ChangeListeners fire for local modifications != 'null', and all
> remote modifications regardless of value.
>
>
> Now I feel lost -- thanks in advance.
>
Re: [CDO] Notifications when reference is set to 'null' (#367738?) [message #1242282 is a reply to message #1235626] Sun, 09 February 2014 09:12 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6457
Registered: July 2009
Senior Member
I've reopened https://bugs.eclipse.org/bugs/show_bug.cgi?id=367738 and added the information you've prvided here.

Cheers
/Eike

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


Am 24.01.2014 21:59, schrieb Jon Doe:
> Looking deeper into the matter, something seems to be wrong with
> 'oldValue's of Notifications.
>
> Btw, this is Eclipse 4.3.1 with CDO 4.2 20130918 on Linux.
>
> As mentioned, my application (= e.g. bound Viewers..) does not react on
> the "local" change of a reference to value 'null'. Viewers and listeners
> react on changing references to *other* (non-null) values, and they
> react on changes to value 'null' when the change was committed from
> another session(sic).
>
> Bug 367738, result of ~2 years old thread "[CDO]
> Notification#getOldValue always null?", was apparently closed to sudden
> lack of any interest.
> [ https://bugs.eclipse.org/bugs/show_bug.cgi?id=367738 ]
>
> According to that thread, the original poster encountered unexpected
> 'oldValue's valued 'null'.
>
> My problem also seems to be related to getting unexpected 'oldValue's of
> value 'null'".
>
> My (local) Viewers do not react, because method "isTouch", in class
> org.eclipse.emf.common.notify.impl.NotificationImpl for event-types
> (non-primitive-)SET and UNSET returns:
>
> oldValue == null ? newValue == null : oldValue.equals(newValue)
>
>
> In my case (local change), and --probably same issue as for the creator
> of bug 367738--, 'oldValue' is (incorrectly? but always) null, so when
> newValue [UNSET/SET value 'null'] is 'null', too - local Viewers will
> not update.
>
>
> --
> For me personally I hacked kindof
>
> if type==UNSET then oldValue=new Object()
>
> into org.eclipse.emf.internal.cdo.object.CDONotificationBuilder to fool
> this rule, and .. I do get my updates.
> --
>
>
> I personally am too new to all this to dare to call this a bug, but when
> changing a reference from "anything non-null" to "null", or when
> unsetting a reference, oldValue should not be null.
>
> Let me know if this is by intention and how to safely work around in
> that case.
>
>
>
>
> On 23.01.2014 16:24, Jon Doe wrote:
>> Hello,
>>
>> having classes 'A' and 'B', with 'A.b' referencing/containing instances
>> of 'B', I stumbled over the following oddity when setting 'A.b' to null:
>>
>> Other "local" views and transactions [from same CDOSession] do *not* get
>> notified when 'A.b' is set to 'null', but they get notified when the
>> reference is changed to another instance of 'B'.
>>
>> In other clients ["remote"], changes are visible immediately --
>> regardless if 'A.b' is set to 'null' or another instance of 'B'.
>> (So the client which sets to 'null' does NOT reflect the changes, but
>> all other clients do so)
>>
>>
>> On the one hand I might have overseen something obvious to those who
>> know what they're doing, on the other hand I'm a bit confused why things
>> work for "remote" clients as expectedly.
>>
>>
>> In short:
>> EMFObservables.observeValue((A) instance, (EReference) bReference);
>>
>> (Value)ChangeListeners fire for local modifications != 'null', and all
>> remote modifications regardless of value.
>>
>>
>> Now I feel lost -- thanks in advance.
>>


Re: [CDO] Notifications when reference is set to 'null' (#367738?) [message #1243237 is a reply to message #1242282] Mon, 10 February 2014 18:07 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6457
Registered: July 2009
Senior Member
Now I've added a test case and it succeeds. Please CC yourself to https://bugs.eclipse.org/bugs/show_bug.cgi?id=367738
and let me know if that covers your scenario ;-)

Cheers
/Eike

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


Am 09.02.2014 10:12, schrieb Eike Stepper:
> I've reopened https://bugs.eclipse.org/bugs/show_bug.cgi?id=367738 and added the information you've prvided here.
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
> Am 24.01.2014 21:59, schrieb Jon Doe:
>> Looking deeper into the matter, something seems to be wrong with
>> 'oldValue's of Notifications.
>>
>> Btw, this is Eclipse 4.3.1 with CDO 4.2 20130918 on Linux.
>>
>> As mentioned, my application (= e.g. bound Viewers..) does not react on
>> the "local" change of a reference to value 'null'. Viewers and listeners
>> react on changing references to *other* (non-null) values, and they
>> react on changes to value 'null' when the change was committed from
>> another session(sic).
>>
>> Bug 367738, result of ~2 years old thread "[CDO]
>> Notification#getOldValue always null?", was apparently closed to sudden
>> lack of any interest.
>> [ https://bugs.eclipse.org/bugs/show_bug.cgi?id=367738 ]
>>
>> According to that thread, the original poster encountered unexpected
>> 'oldValue's valued 'null'.
>>
>> My problem also seems to be related to getting unexpected 'oldValue's of
>> value 'null'".
>>
>> My (local) Viewers do not react, because method "isTouch", in class
>> org.eclipse.emf.common.notify.impl.NotificationImpl for event-types
>> (non-primitive-)SET and UNSET returns:
>>
>> oldValue == null ? newValue == null : oldValue.equals(newValue)
>>
>>
>> In my case (local change), and --probably same issue as for the creator
>> of bug 367738--, 'oldValue' is (incorrectly? but always) null, so when
>> newValue [UNSET/SET value 'null'] is 'null', too - local Viewers will
>> not update.
>>
>>
>> --
>> For me personally I hacked kindof
>>
>> if type==UNSET then oldValue=new Object()
>>
>> into org.eclipse.emf.internal.cdo.object.CDONotificationBuilder to fool
>> this rule, and .. I do get my updates.
>> --
>>
>>
>> I personally am too new to all this to dare to call this a bug, but when
>> changing a reference from "anything non-null" to "null", or when
>> unsetting a reference, oldValue should not be null.
>>
>> Let me know if this is by intention and how to safely work around in
>> that case.
>>
>>
>>
>>
>> On 23.01.2014 16:24, Jon Doe wrote:
>>> Hello,
>>>
>>> having classes 'A' and 'B', with 'A.b' referencing/containing instances
>>> of 'B', I stumbled over the following oddity when setting 'A.b' to null:
>>>
>>> Other "local" views and transactions [from same CDOSession] do *not* get
>>> notified when 'A.b' is set to 'null', but they get notified when the
>>> reference is changed to another instance of 'B'.
>>>
>>> In other clients ["remote"], changes are visible immediately --
>>> regardless if 'A.b' is set to 'null' or another instance of 'B'.
>>> (So the client which sets to 'null' does NOT reflect the changes, but
>>> all other clients do so)
>>>
>>>
>>> On the one hand I might have overseen something obvious to those who
>>> know what they're doing, on the other hand I'm a bit confused why things
>>> work for "remote" clients as expectedly.
>>>
>>>
>>> In short:
>>> EMFObservables.observeValue((A) instance, (EReference) bReference);
>>>
>>> (Value)ChangeListeners fire for local modifications != 'null', and all
>>> remote modifications regardless of value.
>>>
>>>
>>> Now I feel lost -- thanks in advance.
>>>
>


Re: [CDO] Notifications when reference is set to 'null' (#367738?) [message #1245208 is a reply to message #1243237] Thu, 13 February 2014 13:13 Go to previous messageGo to next message
Jon Doe is currently offline Jon DoeFriend
Messages: 7
Registered: June 2012
Junior Member
there's one difference in your test-case compared to my scenario:

I assume property 'name' is a simple string, not a reference to some
other instance.

(If I had a/"the" CDO-test-environment already configured here, I would
have added an appropiate testcase -- sorry for now)



On 10.02.2014 19:07, Eike Stepper wrote:
> Now I've added a test case and it succeeds. Please CC yourself to
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=367738 and let me know if
> that covers your scenario ;-)
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
> Am 09.02.2014 10:12, schrieb Eike Stepper:
>> I've reopened https://bugs.eclipse.org/bugs/show_bug.cgi?id=367738 and
>> added the information you've prvided here.
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>> Am 24.01.2014 21:59, schrieb Jon Doe:
>>> Looking deeper into the matter, something seems to be wrong with
>>> 'oldValue's of Notifications.
>>>
>>> Btw, this is Eclipse 4.3.1 with CDO 4.2 20130918 on Linux.
>>>
>>> As mentioned, my application (= e.g. bound Viewers..) does not react on
>>> the "local" change of a reference to value 'null'. Viewers and listeners
>>> react on changing references to *other* (non-null) values, and they
>>> react on changes to value 'null' when the change was committed from
>>> another session(sic).
>>>
>>> Bug 367738, result of ~2 years old thread "[CDO]
>>> Notification#getOldValue always null?", was apparently closed to sudden
>>> lack of any interest.
>>> [ https://bugs.eclipse.org/bugs/show_bug.cgi?id=367738 ]
>>>
>>> According to that thread, the original poster encountered unexpected
>>> 'oldValue's valued 'null'.
>>>
>>> My problem also seems to be related to getting unexpected 'oldValue's of
>>> value 'null'".
>>>
>>> My (local) Viewers do not react, because method "isTouch", in class
>>> org.eclipse.emf.common.notify.impl.NotificationImpl for event-types
>>> (non-primitive-)SET and UNSET returns:
>>>
>>> oldValue == null ? newValue == null : oldValue.equals(newValue)
>>>
>>>
>>> In my case (local change), and --probably same issue as for the creator
>>> of bug 367738--, 'oldValue' is (incorrectly? but always) null, so when
>>> newValue [UNSET/SET value 'null'] is 'null', too - local Viewers will
>>> not update.
>>>
>>>
>>> --
>>> For me personally I hacked kindof
>>>
>>> if type==UNSET then oldValue=new Object()
>>>
>>> into org.eclipse.emf.internal.cdo.object.CDONotificationBuilder to fool
>>> this rule, and .. I do get my updates.
>>> --
>>>
>>>
>>> I personally am too new to all this to dare to call this a bug, but when
>>> changing a reference from "anything non-null" to "null", or when
>>> unsetting a reference, oldValue should not be null.
>>>
>>> Let me know if this is by intention and how to safely work around in
>>> that case.
>>>
>>>
>>>
>>>
>>> On 23.01.2014 16:24, Jon Doe wrote:
>>>> Hello,
>>>>
>>>> having classes 'A' and 'B', with 'A.b' referencing/containing instances
>>>> of 'B', I stumbled over the following oddity when setting 'A.b' to
>>>> null:
>>>>
>>>> Other "local" views and transactions [from same CDOSession] do *not*
>>>> get
>>>> notified when 'A.b' is set to 'null', but they get notified when the
>>>> reference is changed to another instance of 'B'.
>>>>
>>>> In other clients ["remote"], changes are visible immediately --
>>>> regardless if 'A.b' is set to 'null' or another instance of 'B'.
>>>> (So the client which sets to 'null' does NOT reflect the changes, but
>>>> all other clients do so)
>>>>
>>>>
>>>> On the one hand I might have overseen something obvious to those who
>>>> know what they're doing, on the other hand I'm a bit confused why
>>>> things
>>>> work for "remote" clients as expectedly.
>>>>
>>>>
>>>> In short:
>>>> EMFObservables.observeValue((A) instance, (EReference) bReference);
>>>>
>>>> (Value)ChangeListeners fire for local modifications != 'null', and all
>>>> remote modifications regardless of value.
>>>>
>>>>
>>>> Now I feel lost -- thanks in advance.
>>>>
>>
>
Re: [CDO] Notifications when reference is set to 'null' (#367738?) [message #1245391 is a reply to message #1245208] Thu, 13 February 2014 18:52 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6457
Registered: July 2009
Senior Member
Am 13.02.2014 14:13, schrieb Jon Doe:
> there's one difference in your test-case compared to my scenario:
>
> I assume property 'name' is a simple string, not a reference to some
> other instance.
I've added more test cases:
http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_367738_Test.java

They all succeed. The only problem seems to be with a very specific order of attachments to the resource in combination
with containment proxies. I'll investigate that but I doubt that this relates to your problem.

All these tests were run against latest 4.3 CDO. What version are you using?

Cheers
/Eike

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


Previous Topic:TransactionalEditingDomain with Eclipse's IOperationHistory
Next Topic:User Management APIs
Goto Forum:
  


Current Time: Thu Dec 12 20:07:54 GMT 2019

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

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

Back to the top