Bug 505894 - [DataBinding] ValueBinding.validateTargetToModel() Overwrites Validation Status
Summary: [DataBinding] ValueBinding.validateTargetToModel() Overwrites Validation Status
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.6   Edit
Hardware: PC Windows 10
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2016-10-13 09:22 EDT by Stephan Hildebrandt CLA
Modified: 2020-03-22 16:39 EDT (History)
1 user (show)

See Also:


Attachments
JUnit test, which discovers the described bug. (4.94 KB, application/zip)
2016-10-14 09:38 EDT, Stephan Hildebrandt CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Hildebrandt CLA 2016-10-13 09:22:25 EDT
I am using a ValueBinding with a model observable of type String and a target observable of type int. When the binding is initialized, the model observable's value is propagated to the target observable (see ValueBinding.postInit()). In this process, the String is converted to an int. If this conversion fails, the ValueBinding's validation status is set to ERROR. However, after updateModelToTarget() postInit() calls validateTargetToModel(). This overwrites the validation status with OK and hides the conversion error.

I think, postInit() should only call validateTargetToModel() if the validation status is OK after updateModelToTarget was executed. However, the JavaDoc of updateModelToTarget() states "There is no guarantee that the state will have been updated by the time this call returns.", so this problem does not seem to be that easy to fix.
Comment 1 Patrik Suzzi CLA 2016-10-14 09:15:23 EDT
Could you please attach a simple project with steps to reproduce the issue ?
Comment 2 Stephan Hildebrandt CLA 2016-10-14 09:38:47 EDT
Created attachment 264859 [details]
JUnit test, which discovers the described bug.
Comment 3 Stephan Hildebrandt CLA 2016-10-14 09:39:57 EDT
The attached project contains a JUnit test, which fails because the validation status is OK after the binding is initialized.
Comment 4 Eclipse Genie CLA 2020-03-22 16:39:25 EDT
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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.

--
The automated Eclipse Genie.