aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From timothyjw...@apache.org
Subject svn commit: r1161590 - /aries/trunk/util/src/main/java/org/apache/aries/util/AriesFrameworkUtil.java
Date Thu, 25 Aug 2011 14:55:03 GMT
Author: timothyjward
Date: Thu Aug 25 14:55:02 2011
New Revision: 1161590

URL: http://svn.apache.org/viewvc?rev=1161590&view=rev
Log:
ARIES-718: Avoid NPEs when getting ClassLoaders for null bundles

Modified:
    aries/trunk/util/src/main/java/org/apache/aries/util/AriesFrameworkUtil.java

Modified: aries/trunk/util/src/main/java/org/apache/aries/util/AriesFrameworkUtil.java
URL: http://svn.apache.org/viewvc/aries/trunk/util/src/main/java/org/apache/aries/util/AriesFrameworkUtil.java?rev=1161590&r1=1161589&r2=1161590&view=diff
==============================================================================
--- aries/trunk/util/src/main/java/org/apache/aries/util/AriesFrameworkUtil.java (original)
+++ aries/trunk/util/src/main/java/org/apache/aries/util/AriesFrameworkUtil.java Thu Aug 25
14:55:02 2011
@@ -52,7 +52,7 @@ public final class AriesFrameworkUtil 
    */
   public static ClassLoader getClassLoader(Bundle b)
   {
-    if (b.getState() != Bundle.UNINSTALLED && b.getState() != Bundle.INSTALLED) {
+    if (b != null && b.getState() != Bundle.UNINSTALLED && b.getState() !=
Bundle.INSTALLED) {
       return worker.getClassLoader(b);
     } else {
       return null;
@@ -86,6 +86,8 @@ public final class AriesFrameworkUtil 
    */
   public static ClassLoader getClassLoaderForced(Bundle b)
   {
+    if (b == null)
+      return null;
     try {
       b.loadClass("java.lang.Object");
     } catch (ClassNotFoundException e) {



Mime
View raw message