Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDJ Houghton2009-11-17 21:43:05 +0000
committerDJ Houghton2009-11-17 21:43:05 +0000
commit9cbfbfccf86b25ff544c3396fd78d0e220e5934b (patch)
tree2cb30dc6fc683f20e2f55a8e7a56daad28a77d63
parent8a064a1f510528a17b594e0ee9bdad3f587411c8 (diff)
downloadrt.equinox.bundles-9cbfbfccf86b25ff544c3396fd78d0e220e5934b.tar.gz
rt.equinox.bundles-9cbfbfccf86b25ff544c3396fd78d0e220e5934b.tar.xz
rt.equinox.bundles-9cbfbfccf86b25ff544c3396fd78d0e220e5934b.zip
Bug 293820 - [prefs] Thread safety problem in InstancePreferencesR35x_v20091117
-rw-r--r--bundles/org.eclipse.equinox.preferences/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/ConfigurationPreferences.java19
-rw-r--r--bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/DefaultPreferences.java6
-rw-r--r--bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/InstancePreferences.java6
4 files changed, 18 insertions, 15 deletions
diff --git a/bundles/org.eclipse.equinox.preferences/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.preferences/META-INF/MANIFEST.MF
index 3a13b8939..cf9bdfaa2 100644
--- a/bundles/org.eclipse.equinox.preferences/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.preferences/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.preferences; singleton:=true
-Bundle-Version: 3.2.300.qualifier
+Bundle-Version: 3.2.301.qualifier
Bundle-Activator: org.eclipse.core.internal.preferences.Activator
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/ConfigurationPreferences.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/ConfigurationPreferences.java
index b2ae5ac60..2941f2319 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/ConfigurationPreferences.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/ConfigurationPreferences.java
@@ -11,11 +11,11 @@
package org.eclipse.core.internal.preferences;
import java.net.URL;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.*;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.osgi.service.datalocation.Location;
/**
* @since 3.0
@@ -28,14 +28,17 @@ public class ConfigurationPreferences extends EclipsePreferences {
private IPath location;
private IEclipsePreferences loadLevel;
// cache which nodes have been loaded from disk
- private static Set loadedNodes = new HashSet();
+ private static Set loadedNodes = Collections.synchronizedSet(new HashSet());
private static boolean initialized = false;
private static IPath baseLocation;
static {
- URL url = PreferencesOSGiUtils.getDefault().getConfigurationLocation().getURL();
- if (url != null)
- baseLocation = new Path(url.getFile());
+ Location location = PreferencesOSGiUtils.getDefault().getConfigurationLocation();
+ if (location != null) {
+ URL url = location.getURL();
+ if (url != null)
+ baseLocation = new Path(url.getFile());
+ }
}
/**
@@ -70,11 +73,11 @@ public class ConfigurationPreferences extends EclipsePreferences {
return location;
}
- protected synchronized boolean isAlreadyLoaded(IEclipsePreferences node) {
+ protected boolean isAlreadyLoaded(IEclipsePreferences node) {
return loadedNodes.contains(node.name());
}
- protected synchronized void loaded() {
+ protected void loaded() {
loadedNodes.add(name());
}
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/DefaultPreferences.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/DefaultPreferences.java
index 6dda6f4c6..c42f904b2 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/DefaultPreferences.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/DefaultPreferences.java
@@ -29,7 +29,7 @@ import org.osgi.util.tracker.ServiceTracker;
*/
public class DefaultPreferences extends EclipsePreferences {
// cache which nodes have been loaded from disk
- private static Set loadedNodes = new HashSet();
+ private static Set loadedNodes = Collections.synchronizedSet(new HashSet());
private static final String KEY_PREFIX = "%"; //$NON-NLS-1$
private static final String KEY_DOUBLE_PREFIX = "%%"; //$NON-NLS-1$
private static final IPath NL_DIR = new Path("$nl$"); //$NON-NLS-1$
@@ -221,7 +221,7 @@ public class DefaultPreferences extends EclipsePreferences {
return new DefaultPreferences(nodeParent, nodeName, context);
}
- protected synchronized boolean isAlreadyLoaded(IEclipsePreferences node) {
+ protected boolean isAlreadyLoaded(IEclipsePreferences node) {
return loadedNodes.contains(node.name());
}
@@ -287,7 +287,7 @@ public class DefaultPreferences extends EclipsePreferences {
return result;
}
- protected synchronized void loaded() {
+ protected void loaded() {
loadedNodes.add(name());
}
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/InstancePreferences.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/InstancePreferences.java
index 15bdf4d84..685bd8972 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/InstancePreferences.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/InstancePreferences.java
@@ -29,7 +29,7 @@ public class InstancePreferences extends EclipsePreferences {
private IEclipsePreferences loadLevel;
private IPath location;
// cache which nodes have been loaded from disk
- private static Set loadedNodes = new HashSet();
+ private static Set loadedNodes = Collections.synchronizedSet(new HashSet());
private static boolean initialized = false;
private static IPath baseLocation;
@@ -71,11 +71,11 @@ public class InstancePreferences extends EclipsePreferences {
// accessed before the instance location is set.
}
- protected synchronized boolean isAlreadyLoaded(IEclipsePreferences node) {
+ protected boolean isAlreadyLoaded(IEclipsePreferences node) {
return loadedNodes.contains(node.name());
}
- protected synchronized void loaded() {
+ protected void loaded() {
loadedNodes.add(name());
}

Back to the top