Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/TestModuleContainer.java16
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java15
2 files changed, 8 insertions, 23 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/TestModuleContainer.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/TestModuleContainer.java
index 623689639..a2900f742 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/TestModuleContainer.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/TestModuleContainer.java
@@ -3501,22 +3501,6 @@ public class TestModuleContainer extends AbstractTest {
}
@Test
- public void testPackageNamespaceBundleSymbolicNameAttribute() throws Exception {
- DummyContainerAdaptor adaptor = createDummyAdaptor();
- ModuleContainer container = adaptor.getContainer();
- // install the system.bundle
- Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container);
- ResolutionReport report = container.resolve(Arrays.asList(systemBundle), true);
- Assert.assertNull("Failed to resolve system.bundle.", report.getResolutionException());
-
- ModuleWiring wiring = systemBundle.getCurrentRevision().getWiring();
- List<BundleCapability> packages = wiring.getCapabilities(PackageNamespace.PACKAGE_NAMESPACE);
- Assert.assertEquals("Wrong number of host packages.", 2, packages.size());
- //system.bundle alias shouldn't be added to the bundle-symbolic-name attribute of the osgi.wiring.package capabilities of SYSTEM BUNDLE.
- Assert.assertEquals("Wrong bundle-symbolic-name attribute", "org.eclipse.osgi", packages.get(0).getAttributes().get(PackageNamespace.CAPABILITY_BUNDLE_SYMBOLICNAME_ATTRIBUTE));
- }
-
- @Test
public void testStartDeadLock() throws BundleException, InterruptedException, IOException {
CountDownLatch startLatch = new CountDownLatch(1);
CountDownLatch stopLatch = new CountDownLatch(1);
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java
index b1bfbc8ec..239597afa 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java
@@ -100,13 +100,13 @@ public final class OSGiManifestBuilderFactory {
validateHeaders(manifest);
}
- setSymbolicNameAndVersion(builder, manifest, symbolicNameAlias, manifestVersion);
+ Object symbolicName = getSymbolicNameAndVersion(builder, manifest, symbolicNameAlias, manifestVersion);
Collection<Map<String, Object>> exportedPackages = new ArrayList<>();
- getPackageExports(builder, ManifestElement.parseHeader(Constants.EXPORT_PACKAGE, manifest.get(Constants.EXPORT_PACKAGE)), exportedPackages);
- getPackageExports(builder, ManifestElement.parseHeader(HEADER_OLD_PROVIDE_PACKAGE, manifest.get(HEADER_OLD_PROVIDE_PACKAGE)), exportedPackages);
+ getPackageExports(builder, ManifestElement.parseHeader(Constants.EXPORT_PACKAGE, manifest.get(Constants.EXPORT_PACKAGE)), symbolicName, exportedPackages);
+ getPackageExports(builder, ManifestElement.parseHeader(HEADER_OLD_PROVIDE_PACKAGE, manifest.get(HEADER_OLD_PROVIDE_PACKAGE)), symbolicName, exportedPackages);
if (extraExports != null && !extraExports.isEmpty()) {
- getPackageExports(builder, ManifestElement.parseHeader(Constants.EXPORT_PACKAGE, extraExports), exportedPackages);
+ getPackageExports(builder, ManifestElement.parseHeader(Constants.EXPORT_PACKAGE, extraExports), symbolicName, exportedPackages);
}
getPackageImports(builder, manifest, exportedPackages, manifestVersion);
@@ -245,7 +245,7 @@ public final class OSGiManifestBuilderFactory {
return manifestVersionHeader == null ? 1 : Integer.parseInt(manifestVersionHeader);
}
- private static void setSymbolicNameAndVersion(ModuleRevisionBuilder builder, Map<String, String> manifest, String symbolicNameAlias, int manifestVersion) throws BundleException {
+ private static Object getSymbolicNameAndVersion(ModuleRevisionBuilder builder, Map<String, String> manifest, String symbolicNameAlias, int manifestVersion) throws BundleException {
boolean isFragment = manifest.get(Constants.FRAGMENT_HOST) != null;
builder.setTypes(isFragment ? BundleRevision.TYPE_FRAGMENT : 0);
String version = manifest.get(Constants.BUNDLE_VERSION);
@@ -311,9 +311,11 @@ public final class OSGiManifestBuilderFactory {
builder.addCapability(IdentityNamespace.IDENTITY_NAMESPACE, directives, identityAttributes);
}
}
+
+ return symbolicName == null ? symbolicNameAlias : symbolicName;
}
- private static void getPackageExports(ModuleRevisionBuilder builder, ManifestElement[] exportElements, Collection<Map<String, Object>> exportedPackages) throws BundleException {
+ private static void getPackageExports(ModuleRevisionBuilder builder, ManifestElement[] exportElements, Object symbolicName, Collection<Map<String, Object>> exportedPackages) throws BundleException {
if (exportElements == null)
return;
for (ManifestElement exportElement : exportElements) {
@@ -326,7 +328,6 @@ public final class OSGiManifestBuilderFactory {
String specVersionAttr = (String) attributes.remove(Constants.PACKAGE_SPECIFICATION_VERSION);
Version version = versionAttr == null ? (specVersionAttr == null ? Version.emptyVersion : Version.parseVersion(specVersionAttr)) : Version.parseVersion(versionAttr);
attributes.put(PackageNamespace.CAPABILITY_VERSION_ATTRIBUTE, version);
- String symbolicName = builder.getSymbolicName();
if (symbolicName != null) {
attributes.put(PackageNamespace.CAPABILITY_BUNDLE_SYMBOLICNAME_ATTRIBUTE, symbolicName);
}

Back to the top