Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 335591 - [prefs] ProjectPreferences are not loaded
Summary: [prefs] ProjectPreferences are not loaded
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 3.7 M6   Edit
Assignee: Szymon Ptaszkiewicz CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 202384
Blocks: 334241
  Show dependency tree
 
Reported: 2011-01-27 11:49 EST by Szymon Ptaszkiewicz CLA
Modified: 2011-02-01 11:06 EST (History)
3 users (show)

See Also:
Szymon.Brandys: review+


Attachments
Patch v.0.1 (1.12 KB, patch)
2011-01-27 11:55 EST, Szymon Ptaszkiewicz CLA
no flags Details | Diff
Patch v.0.2 (5.04 KB, patch)
2011-01-28 08:38 EST, Szymon Ptaszkiewicz CLA
Szymon.Brandys: iplog+
Details | Diff
Patch with lazy initialization (3.21 KB, patch)
2011-01-31 05:15 EST, Szymon Brandys CLA
no flags Details | Diff
More detailed test (3.82 KB, patch)
2011-01-31 08:52 EST, Szymon Ptaszkiewicz CLA
Szymon.Brandys: iplog+
Details | Diff
Patch v.0.2 + more detailed test (4.94 KB, patch)
2011-02-01 10:36 EST, Szymon Brandys CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.