diff options
author | Thomas Watson | 2014-09-30 19:09:30 +0000 |
---|---|---|
committer | Thomas Watson | 2014-09-30 19:09:30 +0000 |
commit | 341891705cb0f38ea99706755e998f27853f183e (patch) | |
tree | 030283cf9fee40bd2af44919b9d805295bc75cd5 /bundles/org.eclipse.osgi | |
parent | 851e05741190a7ee914f2866fab48ff94faa60dd (diff) | |
download | rt.equinox.framework-341891705cb0f38ea99706755e998f27853f183e.tar.gz rt.equinox.framework-341891705cb0f38ea99706755e998f27853f183e.tar.xz rt.equinox.framework-341891705cb0f38ea99706755e998f27853f183e.zip |
Bug 445122 - ClassCastException received when System.getProperties().store() runs on 4.4.1
Diffstat (limited to 'bundles/org.eclipse.osgi')
-rw-r--r-- | bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxConfiguration.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxConfiguration.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxConfiguration.java index f5642453d..7291438cf 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxConfiguration.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxConfiguration.java @@ -67,6 +67,7 @@ public class EquinoxConfiguration implements EnvironmentInfo { private final Map<String, Object> initialConfig; private final Properties configuration; + private final boolean useSystemProperties; private final Debug debug; private final DebugOptions debugOptions; @@ -201,12 +202,16 @@ public class EquinoxConfiguration implements EnvironmentInfo { this.initialConfig = initialConfiguration == null ? new HashMap<String, Object>(0) : new HashMap<String, Object>(initialConfiguration); this.hookRegistry = hookRegistry; Object useSystemPropsValue = initialConfig.get(PROP_USE_SYSTEM_PROPERTIES); - boolean useSystemProps = useSystemPropsValue == null ? false : Boolean.parseBoolean(useSystemPropsValue.toString()); - this.configuration = useSystemProps ? System.getProperties() : new Properties(); + this.useSystemProperties = useSystemPropsValue == null ? false : Boolean.parseBoolean(useSystemPropsValue.toString()); + this.configuration = useSystemProperties ? System.getProperties() : new Properties(); // do this the hard way to handle null values for (Map.Entry<String, ?> initialEntry : this.initialConfig.entrySet()) { if (initialEntry.getValue() == null) { - this.configuration.put(initialEntry.getKey(), NULL_CONFIG); + if (useSystemProperties) { + this.configuration.remove(initialEntry.getKey()); + } else { + this.configuration.put(initialEntry.getKey(), NULL_CONFIG); + } } else { this.configuration.put(initialEntry.getKey(), initialEntry.getValue()); } @@ -446,7 +451,9 @@ public class EquinoxConfiguration implements EnvironmentInfo { public String clearConfiguration(String key) { Object result = configuration.remove(key); - configuration.put(key, NULL_CONFIG); + if (!useSystemProperties) { + configuration.put(key, NULL_CONFIG); + } return result instanceof String ? (String) result : null; } |