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 2007/12/20 20:14:26 UTC
svn commit: r606003 -
/felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
Author: rickhall
Date: Thu Dec 20 11:14:25 2007
New Revision: 606003
URL: http://svn.apache.org/viewvc?rev=606003&view=rev
Log:
Applied patch (FELIX-441) from Guillaume Nodet to properly fire a framework
error event only when a bundle cannot be resolved.
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=606003&r1=606002&r2=606003&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 Thu Dec 20 11:14:25 2007
@@ -1451,18 +1451,28 @@
**/
protected Class loadBundleClass(FelixBundle bundle, String name) throws ClassNotFoundException
{
+ if (bundle.getInfo().getState() == Bundle.UNINSTALLED)
+ {
+ throw new IllegalStateException("Bundle is uninstalled");
+ }
+ else if (bundle.getInfo().getState() == Bundle.INSTALLED)
+ {
+ try
+ {
+ _resolveBundle(bundle);
+ }
+ catch (BundleException ex)
+ {
+ // The spec says we must fire a framework error.
+ fireFrameworkEvent(FrameworkEvent.ERROR, bundle, ex);
+ // Then throw a class not found exception.
+ throw new ClassNotFoundException(name);
+ }
+ }
Class clazz = bundle.getInfo().getCurrentModule().getClass(name);
if (clazz == null)
{
- // Throw exception.
- ClassNotFoundException ex = new ClassNotFoundException(name);
-
- // The spec says we must fire a framework error.
- fireFrameworkEvent(
- FrameworkEvent.ERROR, bundle,
- new BundleException(ex.getMessage()));
-
- throw ex;
+ throw new ClassNotFoundException(name);
}
return clazz;
}