diff options
author | Thomas Watson | 2019-02-11 21:37:02 +0000 |
---|---|---|
committer | Thomas Watson | 2019-02-11 21:37:02 +0000 |
commit | 3e6b090cd7220aa3f733ea9a3cb34412b500cb6e (patch) | |
tree | 8de3f33c1c740b05050223dac991780e08b7995a | |
parent | 924b1a8a0b000cc9293a7aa22ec599bf3df46cd7 (diff) | |
download | rt.equinox.framework-3e6b090cd7220aa3f733ea9a3cb34412b500cb6e.tar.gz rt.equinox.framework-3e6b090cd7220aa3f733ea9a3cb34412b500cb6e.tar.xz rt.equinox.framework-3e6b090cd7220aa3f733ea9a3cb34412b500cb6e.zip |
Revert "Bug 542691 - Stop adding the system.bundle alias to the"Y20190213-0305I20190212-1800I20190211-1800
This reverts commit 79e672bcbfdb99bd8b26771d9cfa859e531a908a.
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); } |