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.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