Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnjum Fatima2018-12-07 16:47:27 -0500
committerAnjum Fatima2018-12-17 14:04:55 -0500
commite71a10af60b07f92d918a5c103fa27331d9a3ddc (patch)
tree552b7fde56be519960d3a304400788913c193d65
parentf2691ad6b309188f0909cc5e67c10698d3a0a136 (diff)
downloadrt.equinox.framework-I20181217-1800.tar.gz
rt.equinox.framework-I20181217-1800.tar.xz
rt.equinox.framework-I20181217-1800.zip
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>
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/TestModuleContainer.java27
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolutionReport.java2
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);
}

Back to the top