Author: thomas.diesler(a)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;
Show replies by date