Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSzymon Ptaszkiewicz2013-10-14 07:49:12 +0000
committerGerrit Code Review @ Eclipse.org2013-10-24 09:00:11 +0000
commitc9b101ad6019999bbc60789881427939c6977da2 (patch)
treed84d20930f87138f41ba1aa21c9e8f8ab92d988b /bundles/org.eclipse.core.net
parent7e0b232400cb860bb566abe97003da0408e5e219 (diff)
downloadeclipse.platform.team-c9b101ad6019999bbc60789881427939c6977da2.tar.gz
eclipse.platform.team-c9b101ad6019999bbc60789881427939c6977da2.tar.xz
eclipse.platform.team-c9b101ad6019999bbc60789881427939c6977da2.zip
Bug 419228 - [Net] PreferenceModifyListener pollutes exported preferences
Change-Id: I2907c8cd1e9cd9a0a662c45652a69948e8cc75da Signed-off-by: Szymon Ptaszkiewicz <szymon.ptaszkiewicz@pl.ibm.com>
Diffstat (limited to 'bundles/org.eclipse.core.net')
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceModifyListener.java20
1 files changed, 15 insertions, 5 deletions
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceModifyListener.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceModifyListener.java
index 0f5198221..57f9d3b4a 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceModifyListener.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceModifyListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,6 +14,7 @@ import org.eclipse.core.runtime.preferences.ConfigurationScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.osgi.service.prefs.BackingStoreException;
+import org.osgi.service.prefs.Preferences;
public class PreferenceModifyListener extends
org.eclipse.core.runtime.preferences.PreferenceModifyListener {
@@ -23,11 +24,20 @@ public class PreferenceModifyListener extends
}
public IEclipsePreferences preApply(IEclipsePreferences node) {
+ // the node does not need to be the root of the hierarchy
+ Preferences root = node.node("/"); //$NON-NLS-1$
try {
- if (node.nodeExists(InstanceScope.SCOPE)) {
- ((ProxyManager)ProxyManager.getProxyManager()).migrateInstanceScopePreferences(
- node.node(InstanceScope.SCOPE).node(Activator.ID),
- node.node(ConfigurationScope.SCOPE).node(Activator.ID), false);
+ // we must not create empty preference nodes, so first check if the node exists
+ if (root.nodeExists(InstanceScope.SCOPE)) {
+ Preferences instance = root.node(InstanceScope.SCOPE);
+ // we must not create empty preference nodes, so first check if the node exists
+ if (instance.nodeExists(Activator.ID)) {
+ ((ProxyManager) ProxyManager.getProxyManager())
+ .migrateInstanceScopePreferences(
+ instance.node(Activator.ID),
+ root.node(ConfigurationScope.SCOPE).node(
+ Activator.ID), false);
+ }
}
} catch (BackingStoreException e) {
Activator.logError("Could not access instance preferences", e); //$NON-NLS-1$

Back to the top