From 64e9d534287593e7be365973a5d1084298a65f3e Mon Sep 17 00:00:00 2001 From: Arnstein Ressem Date: Fri, 6 Jan 2023 15:09:17 +0100 Subject: Revert "Improve user friendliness when class resolution fails." --- .../src/main/java/com/yahoo/osgi/OsgiImpl.java | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'container-core/src/main/java/com/yahoo/osgi') diff --git a/container-core/src/main/java/com/yahoo/osgi/OsgiImpl.java b/container-core/src/main/java/com/yahoo/osgi/OsgiImpl.java index 156fa4ab074..2c7a0c2b86b 100644 --- a/container-core/src/main/java/com/yahoo/osgi/OsgiImpl.java +++ b/container-core/src/main/java/com/yahoo/osgi/OsgiImpl.java @@ -62,18 +62,13 @@ public class OsgiImpl implements Osgi { if (bundle != null) { return resolveFromBundle(spec, bundle); } else { - if (jdiscOsgi.isFelixFramework() && ! spec.bundle.equals(spec.classId)) { - // Bundle was explicitly specified, but not found. - throw new IllegalArgumentException("Could not find bundle " + spec.bundle + - ". " + bundleResolutionErrorMessage(spec.bundle)); - } return resolveFromThisBundleOrSystemBundle(spec); } } /** - * Tries to resolve the given class from this class' bundle. - * If unsuccessful, resolves the class from the system bundle (jdisc_core). + * Tries to resolve the given class from this class' bundle classloader. + * If unsuccessful, resolves the class from . */ @SuppressWarnings("unchecked") private Class resolveFromThisBundleOrSystemBundle(BundleInstantiationSpecification spec) { @@ -91,14 +86,9 @@ public class OsgiImpl implements Osgi { } } throw new IllegalArgumentException( - "Could not create a component with class '" + spec.classId.getName() + - "'. Tried to load class directly, since no bundle was found for spec: " + spec.bundle + - ". " + bundleResolutionErrorMessage(spec.bundle)); - } - - protected String bundleResolutionErrorMessage(ComponentSpecification bundleSpec) { - return " If a bundle with the same name is installed, there is a either a version mismatch " + - "or the installed bundle's version contains a qualifier string."; + "Could not create a component with id '" + spec.classId.getName() + "'. Tried to load class directly, " + + "since no bundle was found for spec: " + spec.bundle + ". If a bundle with the same name is installed, " + + "there is a either a version mismatch or the installed bundle's version contains a qualifier string."); } @SuppressWarnings("unchecked") -- cgit v1.2.3