Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 359452

Summary: [DataBinding] Master/Detail with DuplexingObservableValue: Incorrect Update of Detail after Edit
Product: [Eclipse Project] Platform Reporter: Yoshi <kacifro>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 4.2   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard: stalebug
Attachments:
Description Flags
JUnit 4 test case
none
Proposed fix
none
Stipped-down test case none

Description Yoshi CLA 2011-09-29 12:16:45 EDT
Build Identifier: M20100909-0800

Hi

Cf. steps to reproduce.

Pardon me if I'm missing something obvious...

Reproducible: Always

Steps to Reproduce:
1. Launch Snippet028DuplexingObservableValue.java.
2. Select the table row "Indiana Jones and the Kingdom of the Crystal Skull".
3. In the detail part, edit "Director" from "Steven Spielberg" to "xxx"; verify that this change is reflected in the master table.
4. Select the table row "Raiders of the Lost Ark". In the detail part, "xxx" shows up as "Director" instead of the expected "Steven Spielberg".
Comment 1 Yoshi CLA 2011-10-04 10:06:17 EDT
Created attachment 204512 [details]
JUnit 4 test case
Comment 2 Yoshi CLA 2011-10-04 10:06:59 EDT
Created attachment 204513 [details]
Proposed fix
Comment 3 Yoshi CLA 2011-10-04 10:08:31 EDT
Hello

It seems that the failure to update the text field has to do with a ValueChangeEvent, fired from DuplexingObservableValue, that contains a ValueDiff which in turn contains the same value ("Steven Spielberg" in the example) as both the old and new value, which makes the governing ValueBinding ignore the update of the Text field.

Ultimately, the bogus ValueDiff boils down to a stale value of the field DuplexingObservableValue.cachedValue. A fix would be to set said field in DuplexingObservableValue.doSetValue(Object).

Cf. attached JUnit test case and patch.

Regards
Comment 4 Yoshi CLA 2011-10-12 12:51:20 EDT
Created attachment 205049 [details]
Stipped-down test case

Hello

Obsoleting the previously attached stand-alone test case, I'm enclosing a patch to DuplexingObservableValueTest of the plug-in org.eclipse.jface.tests.databinding, adding a test method to demonstrate the problem.

In essence, the wrong value is returned by doGetValue() if there are listeners attached and the dirty flag is not set (as would be as a result of a change of the target list).

The previously proposed patch is still valid.
Comment 5 Lars Vogel CLA 2019-11-14 03:36:58 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

If the bug is still relevant, please remove the "stalebug" whiteboard tag.