Bug 18644 - Problem saving plug-in preferences - plug-in metadata directory is not created
Summary: Problem saving plug-in preferences - plug-in metadata directory is not created
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P1 critical (vote)
Target Milestone: 2.0 F3   Edit
Assignee: Debbie Wilson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 19213 19491 19582 19642 19885 20056 20328 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-06-01 19:57 EDT by svritchie CLA
Modified: 2002-06-17 08:38 EDT (History)
14 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description svritchie CLA 2002-06-01 19:57:31 EDT
Environment:
 Windows 2000.
 Integration build 20020601 Sat, 1 Jun 2002 -- 14:19 (-0700). (2nd Build)

Steps to reproduce problem:
 1. Got to Window>Preferences>External Tools>Ant
 2. Select the classpath tab
 3. Click Add jar... button
 4. Select a jar file
 5. Click Apply
 6. Click OK
 7. Close Eclipse
 8. Restart Eclipse
 9. Got to Window>Preferences>External Tools>Ant
10. Select the classpath tab. Jar file is not listed.
Comment 1 svritchie CLA 2002-06-02 12:56:45 EDT
Ant Tasks added in preferences are not saved either.
Comment 2 svritchie CLA 2002-06-03 01:48:52 EDT
This seems to be caused by a missing folder. On a new install the folder 
org.eclipse.ant.core is not created in eclipse\workspace\.metadata\.plugins\. 
If this folder is manually created, the Ant preferences can be saved.

Also missing is folder org.eclipse.ui.externaltools which prevents the External 
Tools preferences from being saved. Other folders may also be missing.
Comment 3 Rodrigo Peretti CLA 2002-06-03 12:08:50 EDT
I'm not sure what has changed but the problem seems to be in 
Plugin.savePluginPreferences(...). It does not create the the folder. It seems 
that the whole problem happens because Platform.getPluginStateLocation(...) 
does not call InternalPlatform.getPluginStateLocation(..., true).
Moving to Platform Core.
Comment 4 DJ Houghton CLA 2002-06-03 15:52:24 EDT
Should fix for 2.0
Comment 5 Bruno Leroux CLA 2002-06-03 16:27:41 EDT
To confirm that the problem is in Plugin.savePluginPreferences you can try to
change values in Preference->Debug it doesn't work. Other preference pages
should have the same problem, for instance a plugin of mine also has the same
problem.

This a very critical problem for a stable build as every plugin relying on
preference store is impacted.
Comment 6 Rodrigo Peretti CLA 2002-06-04 14:24:09 EDT
Just a reminder when fixing this one. When saving the preferences, if an 
IOException is thrown it is currently ignored. We should be at least logging 
it to the console.
Comment 7 Nick Edgar CLA 2002-06-04 16:58:26 EDT
I agree this is a must fix for 2.0.
Comment 8 Andre Weinand CLA 2002-06-06 04:45:39 EDT
*** Bug 19213 has been marked as a duplicate of this bug. ***
Comment 9 Don Park CLA 2002-06-06 04:49:01 EDT
Adding following code fragment inside the try block of 
org.eclipse.core.runtime.Plugin.savePluginPreferences method fixes the problem.

// if preference directory doesn't exist, create it
File prefDir = prefFile.getParentFile();
if (prefDir != null && !prefDir.exists())
    prefDir.mkdir();
Comment 10 Nick Edgar CLA 2002-06-06 13:55:39 EDT
The title of this PR should be generalized.
Comment 11 Debbie Wilson CLA 2002-06-06 15:37:43 EDT
Problem was that PlatformMetaArea.getPluginPreferenceLocation was not creating 
the directories for the plugin state location if they were needed (note that in 
some cases you don't want to create these directories under .metadata you just 
want some idea of where the preferences would be if they existed).  Changes had 
to be made in PreferenceExporter and Plugin to indicate to 
getPluginPreferenceLocation if the directories should or should not be created.
Comment 12 Debbie Wilson CLA 2002-06-06 15:38:19 EDT
Fixed in F3 (or 20020607).
Comment 13 Darin Swanson CLA 2002-06-06 16:02:02 EDT
*** Bug 19491 has been marked as a duplicate of this bug. ***
Comment 14 DJ Houghton CLA 2002-06-07 09:09:11 EDT
*** Bug 19582 has been marked as a duplicate of this bug. ***
Comment 15 John Arthorne CLA 2002-06-07 15:43:34 EDT
*** Bug 19642 has been marked as a duplicate of this bug. ***
Comment 16 John Arthorne CLA 2002-06-11 09:54:41 EDT
*** Bug 19885 has been marked as a duplicate of this bug. ***
Comment 17 DJ Houghton CLA 2002-06-12 14:29:30 EDT
*** Bug 20056 has been marked as a duplicate of this bug. ***
Comment 18 DJ Houghton CLA 2002-06-17 08:38:24 EDT
*** Bug 20328 has been marked as a duplicate of this bug. ***