diff options
author | Thomas Watson | 2019-06-27 13:01:39 +0000 |
---|---|---|
committer | Thomas Watson | 2019-06-27 13:01:39 +0000 |
commit | f6efd65754845c464f62d5da9c9103c316441571 (patch) | |
tree | b43468eaa9303ad8ceb49389ff45f663a0a1a336 | |
parent | 3e2c3675343c3c0e8098a85920be0473749fde60 (diff) | |
download | eclipse.platform.runtime-I20190628-1800.tar.gz eclipse.platform.runtime-I20190628-1800.tar.xz eclipse.platform.runtime-I20190628-1800.zip |
Bug 548137 - Platform.getBundle( Constants.SYSTEM_BUNDLE_SYMBOLICNAME )Y20190701-0635Y20190628-1440I20190630-1800I20190629-1800I20190628-1800I20190627-1800
returns null
Change-Id: Iec0e0cc9300bb888ebe334c2a3312de7fbc26e51
Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
2 files changed, 13 insertions, 0 deletions
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/InternalPlatform.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/InternalPlatform.java index 9ad4cf02e..63b554ed3 100644 --- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/InternalPlatform.java +++ b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/InternalPlatform.java @@ -226,6 +226,9 @@ public final class InternalPlatform { } public Bundle[] getBundles(String symbolicName, String versionRange) { + if (Constants.SYSTEM_BUNDLE_SYMBOLICNAME.equals(symbolicName)) { + symbolicName = context.getBundle(Constants.SYSTEM_BUNDLE_LOCATION).getSymbolicName(); + } Map<String, String> directives = Collections.singletonMap(Namespace.REQUIREMENT_FILTER_DIRECTIVE, getRequirementFilter(symbolicName, versionRange)); Collection<BundleCapability> matchingBundleCapabilities = fwkWiring.findProviders(ModuleContainer diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PlatformTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PlatformTest.java index 0338b8737..6466603ec 100644 --- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PlatformTest.java +++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PlatformTest.java @@ -293,6 +293,16 @@ public class PlatformTest extends RuntimeTest { assertNull("no match => null result", result); } + public void testGetSystemBundle() { + Bundle expectedSystem = RuntimeTestsPlugin.getContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION); + Bundle actualSystem = Platform.getBundle(Constants.SYSTEM_BUNDLE_SYMBOLICNAME); + assertEquals("Wrong system bundle.", expectedSystem, actualSystem); + + Bundle[] actualSystems = Platform.getBundles(Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null); + assertEquals("Wrong number of system bundles.", 1, actualSystems.length); + assertEquals("Wrong system bundle.", expectedSystem, actualSystems[0]); + } + /** * Helper method to create empty bundles with just name and version given. The * bundles are packaged to jars and installed into the container. The jars are |