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

Bug 335591

Summary: [prefs] ProjectPreferences are not loaded
Product: [Eclipse Project] Platform Reporter: Szymon Ptaszkiewicz <sptaszkiewicz>
Component: ResourcesAssignee: Szymon Ptaszkiewicz <sptaszkiewicz>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: curtis.windatt.public, daniel_megert, Szymon.Brandys
Version: 3.7Flags: Szymon.Brandys: review+
Target Milestone: 3.7 M6   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 202384    
Bug Blocks: 334241    
Attachments:
Description Flags
Patch v.0.1
none
Patch v.0.2
Szymon.Brandys: iplog+
Patch with lazy initialization
none
More detailed test
Szymon.Brandys: iplog+
Patch v.0.2 + more detailed test none

Description Szymon Ptaszkiewicz CLA 2011-01-27 11:49:30 EST
This bug was introduced by fix for bug 202384.

If we are creating a project that already has some preferences then those
preferences are loaded when refreshing inside project.open() but before
initialized(). Nodes are loaded properly but then they got replaced inside
initialized() as the parent node was not initialized yet. Those nodes are still
in loadedNodes but they do not reflect the real content of prefs files any
more. We get the state were loadedNodes claim that our preferences are
correctly loaded but those nodes are empty.

For now, I can see two possible solutions: call removeNodes(this) inside initialize() or call ((ProjectPreferences) parent).initialize() inside
load() so that even if we are refreshing, parent preferences will get
initialized properly.
Comment 1 Szymon Ptaszkiewicz CLA 2011-01-27 11:55:16 EST
Created attachment 187749 [details]
Patch v.0.1
Comment 2 Dani Megert CLA 2011-01-28 02:40:26 EST
Can you provide steps that show the problem?
We also need additional tests.
Comment 3 Szymon Ptaszkiewicz CLA 2011-01-28 08:38:17 EST
Created attachment 187837 [details]
Patch v.0.2

Patch and test showing the problem. Before bug 202384 got fixed the test would have passed. I've changed also the test for 202384 in case the test would be run on platform with default UTF-8 encoding.
Comment 4 Szymon Ptaszkiewicz CLA 2011-01-28 08:39:31 EST
Szymon, please review.
Comment 5 Szymon Brandys CLA 2011-01-28 09:08:03 EST
We will release the fix at the beginning of M6.
Comment 6 Dani Megert CLA 2011-01-28 09:12:35 EST
SzymonP, can you verify that the fix also fixes PDE's broken test. Thanks.
Comment 7 Szymon Ptaszkiewicz CLA 2011-01-28 09:30:35 EST
(In reply to comment #6)
> SzymonP, can you verify that the fix also fixes PDE's broken test. Thanks.

Yes, it does. I have tested the patch on the PDE's broken test without temporary fix that was committed there (using version 1.5).
Comment 8 Szymon Ptaszkiewicz CLA 2011-01-28 09:53:23 EST
The most severe part of the bug is that preferences are lost permanently if we call flush on the broken preferences node. This is what happens in PDE's test. It is not visible unless you compare the content of preference file on disk after the test failed to the version from their zip (or to the version after the test passed).
Comment 9 Szymon Brandys CLA 2011-01-31 05:15:34 EST
Created attachment 187941 [details]
Patch with lazy initialization

Szymon P., I remember I suggested this patch some time ago. It does not fail your tests. Could you verify that it fixes PDE problem too? If yes, we could consider fixing the issue my way.
Comment 10 Szymon Ptaszkiewicz CLA 2011-01-31 08:52:29 EST
Created attachment 187956 [details]
More detailed test
Comment 11 Szymon Brandys CLA 2011-02-01 10:36:00 EST
Created attachment 188053 [details]
Patch v.0.2 + more detailed test
Comment 12 Szymon Brandys CLA 2011-02-01 11:05:32 EST
Thanks Szymon. The fix is in HEAD.