Applied patch (FELIX-750) to improve exception messages.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@703484 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/Felix.java b/framework/src/main/java/org/apache/felix/framework/Felix.java
index 1bf38a1..9b1c86f 100644
--- a/framework/src/main/java/org/apache/felix/framework/Felix.java
+++ b/framework/src/main/java/org/apache/felix/framework/Felix.java
@@ -1568,7 +1568,7 @@
if (!record)
{
throw new BundleException(
- "Cannot start the bundle because its start level is "
+ "Cannot start bundle " + bundle + " because its start level is "
+ info.getStartLevel(getInitialBundleStartLevel())
+ ", which is greater than the framework's start level of "
+ getStartLevel() + ".");
@@ -1583,7 +1583,8 @@
throw new IllegalStateException("Cannot start an uninstalled bundle.");
case Bundle.STARTING:
case Bundle.STOPPING:
- throw new BundleException("Starting a bundle that is starting or stopping is currently not supported.");
+ throw new BundleException(
+ "Bundle " + bundle + " cannot be started, since it is either starting or stopping.");
case Bundle.ACTIVE:
return;
case Bundle.INSTALLED:
@@ -1650,7 +1651,7 @@
}
// Rethrow all other exceptions as a BundleException.
- throw new BundleException("Activator start error.", th);
+ throw new BundleException("Activator start error in bundle " + bundle + ".", th);
}
}
@@ -1930,7 +1931,7 @@
throw (SecurityException) rethrow;
}
- throw new BundleException("Update failed.", rethrow);
+ throw new BundleException("Update of bundle " + bundle + " failed.", rethrow);
}
}
finally
@@ -2048,7 +2049,7 @@
}
// Rethrow all other exceptions as a BundleException.
- throw new BundleException("Activator stop error.", rethrow);
+ throw new BundleException("Activator stop error in bundle " + bundle + ".", rethrow);
}
}
@@ -2073,7 +2074,7 @@
BundleInfo info = bundle.getInfo();
if (info.getState() == Bundle.UNINSTALLED)
{
- throw new IllegalStateException("The bundle is uninstalled.");
+ throw new IllegalStateException("Bundle " + bundle + " is uninstalled.");
}
// Extension Bundles are not removed until the framework is shutdown
@@ -3069,7 +3070,7 @@
// Get exporting bundle information.
FelixBundle exporter = (FelixBundle)
- ((ExportedPackage) ep).getExportingBundle();
+ (ep).getExportingBundle();
// Search the dependents of the exporter's module revisions
// for importers of the specific package.
@@ -3341,7 +3342,7 @@
{
Version bundleVersion = mp.getBundleVersion();
bundleVersion = (bundleVersion == null) ? Version.emptyVersion : bundleVersion;
- String symName = (String) mp.getSymbolicName();
+ String symName = mp.getSymbolicName();
Bundle[] bundles = getBundles();
for (int i = 0; (bundles != null) && (i < bundles.length); i++)
@@ -3352,7 +3353,7 @@
.getInfo().getCurrentHeader().get(Constants.BUNDLE_VERSION));
if (symName.equals(sym) && bundleVersion.equals(ver) && (targetId != id))
{
- throw new BundleException("Bundle symbolic name and version are not unique.");
+ throw new BundleException("Bundle symbolic name and version are not unique: " + sym + ':' + ver);
}
}
}
@@ -4332,4 +4333,4 @@
m_bundleLock.notifyAll();
}
}
-}
+}
\ No newline at end of file