[jboss-osgi-commits] JBoss-OSGI SVN: r90309 - projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/service/hotdeploy/internal.

jboss-osgi-commits at lists.jboss.org jboss-osgi-commits at lists.jboss.org
Wed Jun 17 06:06:42 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-06-17 06:06:41 -0400 (Wed, 17 Jun 2009)
New Revision: 90309

Modified:
   projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/service/hotdeploy/internal/DeploymentScannerImpl.java
Log:
Prevent NPE in getBundles

Modified: projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/service/hotdeploy/internal/DeploymentScannerImpl.java
===================================================================
--- projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/service/hotdeploy/internal/DeploymentScannerImpl.java	2009-06-17 09:47:34 UTC (rev 90308)
+++ projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/service/hotdeploy/internal/DeploymentScannerImpl.java	2009-06-17 10:06:41 UTC (rev 90309)
@@ -229,19 +229,29 @@
    public BundleInfo[] getBundles()
    {
       List<BundleInfo> bundles = new ArrayList<BundleInfo>();
-      for (File file : scanLocation.listFiles())
+      
+      File[] listFiles = scanLocation.listFiles();
+      if (listFiles == null)
+         log.log(LogService.LOG_WARNING, "Cannot list files in: " + scanLocation);
+         
+      if (listFiles != null)
       {
-         BundleInfoImpl info = getBundleInfo(file);
-         
-         Bundle bundle = getInstalledBundle(info);
-         if (bundle != null)
-            info.initFromBundle(bundle);
-         
-         bundles.add(info);
+         for (File file : listFiles)
+         {
+            BundleInfoImpl info = getBundleInfo(file);
+            
+            Bundle bundle = getInstalledBundle(info);
+            if (bundle != null)
+               info.initFromBundle(bundle);
+            
+            bundles.add(info);
+         }
       }
+      
       BundleInfo[] arr = new BundleInfoImpl[bundles.size()];
       return bundles.toArray(arr);
    }
+   
    private void initScanner(BundleContext context)
    {
       scanInterval = 2000;




More information about the jboss-osgi-commits mailing list