felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject svn commit: r687384 - in /felix/trunk/framework/src/main/java/org/apache/felix: framework/Felix.java moduleloader/IModule.java moduleloader/ModuleImpl.java
Date Wed, 20 Aug 2008 16:37:38 GMT
Author: pauls
Date: Wed Aug 20 09:37:33 2008
New Revision: 687384

URL: http://svn.apache.org/viewvc?rev=687384&view=rev
Log:
Better error reporting when loading bundle classes using Bundle.loadClass. We now let the
exception from ModuleImpl.loadClass bubble up instead of swallowing it. (FELIX-674).

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
    felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IModule.java
    felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/ModuleImpl.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=687384&r1=687383&r2=687384&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 Wed Aug 20 09:37:33
2008
@@ -1522,12 +1522,7 @@
                 throw new ClassNotFoundException(name);
             }
         }
-        Class clazz = bundle.getInfo().getCurrentModule().getClass(name);
-        if (clazz == null)
-        {
-            throw new ClassNotFoundException(name);
-        }
-        return clazz;
+        return bundle.getInfo().getCurrentModule().getClass(name);
     }
 
     /**
@@ -2937,7 +2932,14 @@
                 }
             }
         }
-        return (getInfo().getCurrentModule().getClass(clazz.getName()) == clazz) ? this :
null;
+        try 
+        {
+            return (getInfo().getCurrentModule().getClass(clazz.getName()) == clazz) ? this
: null;
+        }
+        catch(ClassNotFoundException ex) 
+        {
+            return null;
+        }
     }
 
     /**
@@ -3549,12 +3551,16 @@
             if (className != null)
             {
                 className = className.trim();
-                Class clazz = info.getCurrentModule().getClass(className);
-                if (clazz == null)
+                Class clazz;
+                try 
                 {
+                    clazz = info.getCurrentModule().getClass(className);
+                }
+                catch (ClassNotFoundException ex) {
                     throw new BundleException("Not found: "
-                        + className, new ClassNotFoundException(className));
+                        + className, ex);
                 }
+
                 activator = (BundleActivator) clazz.newInstance();
             }
         }

Modified: felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IModule.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IModule.java?rev=687384&r1=687383&r2=687384&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IModule.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IModule.java Wed Aug
20 09:37:33 2008
@@ -30,7 +30,7 @@
 
     public boolean isRemovalPending();
 
-    public Class getClass(String name);
+    public Class getClass(String name) throws ClassNotFoundException;
     public URL getResource(String name);
     public Enumeration getResources(String name);
 }
\ No newline at end of file

Modified: felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/ModuleImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/ModuleImpl.java?rev=687384&r1=687383&r2=687384&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/ModuleImpl.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/ModuleImpl.java Wed
Aug 20 09:37:33 2008
@@ -172,7 +172,7 @@
         m_removalPending = removalPending;
     }
 
-    public Class getClass(String name)
+    public Class getClass(String name) throws ClassNotFoundException
     {
         try
         {
@@ -184,8 +184,8 @@
                 Logger.LOG_WARNING,
                 ex.getMessage(),
                 ex);
+            throw ex;
         }
-        return null;
     }
 
     public URL getResource(String name)



Mime
View raw message