You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2008/10/10 16:30:42 UTC

svn commit: r703484 - /felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java

Author: rickhall
Date: Fri Oct 10 07:30:42 2008
New Revision: 703484

URL: http://svn.apache.org/viewvc?rev=703484&view=rev
Log:
Applied patch (FELIX-750) to improve exception messages.

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java?rev=703484&r1=703483&r2=703484&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java Fri Oct 10 07:30:42 2008
@@ -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