Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2014-09-30 19:09:30 +0000
committerThomas Watson2014-09-30 19:09:30 +0000
commit341891705cb0f38ea99706755e998f27853f183e (patch)
tree030283cf9fee40bd2af44919b9d805295bc75cd5 /bundles/org.eclipse.osgi.tests
parent851e05741190a7ee914f2866fab48ff94faa60dd (diff)
downloadrt.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.tests')
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java
index dd1853ca0..393a5e156 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java
@@ -22,6 +22,7 @@ import junit.framework.TestSuite;
import org.eclipse.osgi.internal.framework.EquinoxConfiguration;
import org.eclipse.osgi.launch.Equinox;
import org.eclipse.osgi.service.datalocation.Location;
+import org.eclipse.osgi.service.environment.EnvironmentInfo;
import org.eclipse.osgi.tests.OSGiTestsActivator;
import org.junit.Assert;
import org.osgi.framework.*;
@@ -2207,6 +2208,30 @@ public class SystemBundleTests extends AbstractBundleTests {
equinox.stop();
}
+ public void testNullConfigurationValueSystemProperties() throws BundleException {
+ System.setProperty(nullTest, "system");
+ File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$
+ Map<String, Object> configuration = new HashMap<String, Object>();
+ configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath());
+ configuration.put("osgi.framework.useSystemProperties", "true");
+ configuration.put(nullTest, null);
+ Equinox equinox = new Equinox(configuration);
+ equinox.start();
+
+ String nullValue = equinox.getBundleContext().getProperty(nullTest);
+ assertNull(nullTest + " is not null: " + nullValue, nullValue);
+ assertNull("Did not get null system value.", System.getProperties().get(nullTest));
+
+ // also test EnvironmentInfo effects on system properties
+ ServiceReference<EnvironmentInfo> envRef = equinox.getBundleContext().getServiceReference(EnvironmentInfo.class);
+ EnvironmentInfo envInfo = equinox.getBundleContext().getService(envRef);
+ envInfo.setProperty(getName(), getName());
+ assertEquals("Got wrong value from system properties.", System.getProperty(getName()), getName());
+ envInfo.setProperty(getName(), null);
+ assertNull("Did not get null system value.", System.getProperties().get(getName()));
+ equinox.stop();
+ }
+
public void testSystemNLFragment() throws BundleException {
File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$
Map<String, Object> configuration = new HashMap<String, Object>();

Back to the top