diff options
author | Anjum Fatima | 2018-12-07 21:47:27 +0000 |
---|---|---|
committer | Anjum Fatima | 2018-12-17 19:04:55 +0000 |
commit | e71a10af60b07f92d918a5c103fa27331d9a3ddc (patch) | |
tree | 552b7fde56be519960d3a304400788913c193d65 | |
parent | f2691ad6b309188f0909cc5e67c10698d3a0a136 (diff) | |
download | rt.equinox.framework-e71a10af60b07f92d918a5c103fa27331d9a3ddc.tar.gz rt.equinox.framework-e71a10af60b07f92d918a5c103fa27331d9a3ddc.tar.xz rt.equinox.framework-e71a10af60b07f92d918a5c103fa27331d9a3ddc.zip |
Bug 542537 - ModuleResolutionReport.getResolutionReportMessage throwsY20190102-2200Y20181226-2200Y20181219-2200I20190102-1800I20190101-1800I20181231-1800I20181230-1800I20181229-1800I20181228-1800I20181227-1800I20181226-1800I20181225-1800I20181224-1800I20181223-1800I20181222-1800I20181221-1800I20181220-1800I20181219-1800I20181218-1800I20181218-0120I20181217-1800
ClassCastException for namespace attribute
Change-Id: I1da7125489d495959448ea2a0d086162b6e266e6
Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
Signed-off-by: Anjum Fatima <anjum.eclipse@gmail.com>
2 files changed, 28 insertions, 1 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 57ef9d4ed..813a0189e 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 @@ -3469,6 +3469,33 @@ public class TestModuleContainer extends AbstractTest { } } + @Test + public void testAliasBundleNameReport() throws BundleException, IOException { + DummyContainerAdaptor adaptor = createDummyAdaptor(); + ModuleContainer container = adaptor.getContainer(); + + Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, container); + container.resolve(Collections.singleton(systemBundle), true); + + Map<String, String> b1Manifest = new HashMap<>(); + b1Manifest.put(Constants.BUNDLE_SYMBOLICNAME, "b1"); + b1Manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); + b1Manifest.put(Constants.IMPORT_PACKAGE, "doesnotexist"); + ModuleRevisionBuilder b1Builder = OSGiManifestBuilderFactory.createBuilder(b1Manifest, "alias.name", "", ""); + container.install(systemBundle, "b1", b1Builder, null); + + Map<String, String> b2Manifest = new HashMap<>(); + b2Manifest.put(Constants.BUNDLE_SYMBOLICNAME, "b2"); + b2Manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); + b2Manifest.put(Constants.REQUIRE_BUNDLE, "b1"); + ModuleRevisionBuilder b2Builder = OSGiManifestBuilderFactory.createBuilder(b2Manifest); + Module b2 = container.install(systemBundle, "b2", b2Builder, null); + + ResolutionReport report = container.resolve(Collections.singleton(b2), true); + String message = report.getResolutionReportMessage(b2.getCurrentRevision()); + assertTrue("Wrong error message: " + message, message.contains("b1") && message.contains("alias.name")); + } + private static void assertWires(List<ModuleWire> required, List<ModuleWire>... provided) { for (ModuleWire requiredWire : required) { for (List<ModuleWire> providedList : provided) { diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolutionReport.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolutionReport.java index 08cc43ce8..2e021392d 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolutionReport.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolutionReport.java @@ -169,7 +169,7 @@ class ModuleResolutionReport implements ResolutionReport { private static String createOSGiCapability(Capability cap) { Map<String, Object> attributes = new HashMap<>(cap.getAttributes()); Map<String, String> directives = cap.getDirectives(); - String name = (String) attributes.remove(cap.getNamespace()); + String name = String.valueOf(attributes.remove(cap.getNamespace())); return name + ModuleRevision.toString(attributes, false, true) + ModuleRevision.toString(directives, true, true); } |