Bug 352275 - Empty org.osgi.framework.system.packages.extra causes
"Invalid manifest header Export-Package"
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 baf50b4..d7b362a 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
@@ -1375,6 +1375,32 @@
}
}
+ public void testBug352275() {
+ // simple test to create an embedded framework
+ File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$
+ Properties configuration = new Properties();
+ configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath());
+ configuration.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, "");
+ Equinox equinox = new Equinox(configuration);
+ try {
+ equinox.init();
+ equinox.start();
+ } catch (BundleException e) {
+ fail("Failed to start the framework", e); //$NON-NLS-1$
+ }
+ try {
+ equinox.stop();
+ } catch (BundleException e) {
+ fail("Unexpected erorr stopping framework", e); //$NON-NLS-1$
+ }
+ try {
+ equinox.waitForStop(10000);
+ } catch (InterruptedException e) {
+ fail("Unexpected interrupted exception", e); //$NON-NLS-1$
+ }
+ assertEquals("Wrong state for SystemBundle", Bundle.RESOLVED, equinox.getState()); //$NON-NLS-1$
+ }
+
private static File[] createBundles(File outputDir, int bundleCount) throws IOException {
outputDir.mkdirs();
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/InternalSystemBundle.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/InternalSystemBundle.java
index f19f765..fb352f0 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/InternalSystemBundle.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/InternalSystemBundle.java
@@ -57,10 +57,10 @@
String systemExtraValue = FrameworkProperties.getProperty(systemExtraProp);
if (systemValue == null)
systemValue = systemExtraValue;
- else if (systemExtraValue != null)
+ else if (systemExtraValue != null && systemExtraValue.trim().length() > 0)
systemValue += ", " + systemExtraValue; //$NON-NLS-1$
String result = headers.get(header);
- if (systemValue != null) {
+ if (systemValue != null && systemValue.trim().length() > 0) {
if (result != null)
result += ", " + systemValue; //$NON-NLS-1$
else