You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xbean-scm@geronimo.apache.org by xu...@apache.org on 2012/04/30 12:50:33 UTC

svn commit: r1332151 - /geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/BundleUtils.java

Author: xuhaihong
Date: Mon Apr 30 10:50:33 2012
New Revision: 1332151

URL: http://svn.apache.org/viewvc?rev=1332151&view=rev
Log:
Null checking for bundle location

Modified:
    geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/BundleUtils.java

Modified: geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/BundleUtils.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/BundleUtils.java?rev=1332151&r1=1332150&r2=1332151&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/BundleUtils.java (original)
+++ geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/BundleUtils.java Mon Apr 30 10:50:33 2012
@@ -134,7 +134,7 @@ public class BundleUtils {
 
     /**
      *  Returns bundle (if any) associated with the classloader.
-     * @param classLoader 
+     * @param classLoader
      * @param unwrap if true and if the bundle associated with the context classloader is a
      *        {@link DelegatingBundle}, this function will return the main application bundle
      *        backing the {@link DelegatingBundle}. Otherwise, the bundle associated with
@@ -153,7 +153,7 @@ public class BundleUtils {
     }
 
     /**
-     * If the given bundle is a {@link DelegatingBundle} this function will return the main 
+     * If the given bundle is a {@link DelegatingBundle} this function will return the main
      * application bundle backing the {@link DelegatingBundle}. Otherwise, the bundle
      * passed in is returned as is.
      */
@@ -163,7 +163,7 @@ public class BundleUtils {
         }
         return bundle;
     }
-    
+
     /**
      * Works like {@link Bundle#getEntryPaths(String)} but also returns paths
      * in attached fragment bundles.
@@ -271,7 +271,7 @@ public class BundleUtils {
      * @return
      */
     public static File toFile(String url) {
-        if (url.startsWith(REFERENCE_FILE_SCHEMA)) {
+        if (url !=null && url.startsWith(REFERENCE_FILE_SCHEMA)) {
             File file = new File(url.substring(REFERENCE_FILE_SCHEMA.length()));
             if (file.exists()) {
                 return file;