geronimo-xbean-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1778104 - in /geronimo/xbean/trunk/xbean-finder/src: main/java/org/apache/xbean/finder/ main/java/org/apache/xbean/finder/archive/ test/java/org/apache/xbean/finder/archive/
Date Tue, 10 Jan 2017 10:05:25 GMT
Author: rmannibucau
Date: Tue Jan 10 10:05:25 2017
New Revision: 1778104

URL: http://svn.apache.org/viewvc?rev=1778104&view=rev
Log:
XBEAN-298 file.listFiles() can return null

Modified:
    geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ClassFinder.java
    geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ResourceFinder.java
    geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/archive/FileArchive.java
    geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/archive/FileArchiveTest.java

Modified: geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ClassFinder.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ClassFinder.java?rev=1778104&r1=1778103&r2=1778104&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ClassFinder.java
(original)
+++ geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ClassFinder.java
Tue Jan 10 10:05:25 2017
@@ -176,6 +176,9 @@ public class ClassFinder extends Abstrac
 
     private void scanDir(File dir, List<String> classNames, String packageName) {
         File[] files = dir.listFiles();
+        if (files == null) {
+            return;
+        }
         for (File file : files) {
             if (file.isDirectory()) {
                 scanDir(file, classNames, packageName + file.getName() + ".");

Modified: geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ResourceFinder.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ResourceFinder.java?rev=1778104&r1=1778103&r2=1778104&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ResourceFinder.java
(original)
+++ geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ResourceFinder.java
Tue Jan 10 10:05:25 2017
@@ -847,6 +847,9 @@ public class ResourceFinder {
         File dir = new File(decode(location.getPath()));
         if (dir.isDirectory()) {
             File[] files = dir.listFiles();
+            if (files == null) {
+                return;
+            }
             for (File file : files) {
                 if (!file.isDirectory()) {
                     String name = file.getName();

Modified: geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/archive/FileArchive.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/archive/FileArchive.java?rev=1778104&r1=1778103&r2=1778104&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/archive/FileArchive.java
(original)
+++ geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/archive/FileArchive.java
Tue Jan 10 10:05:25 2017
@@ -109,6 +109,10 @@ public class FileArchive implements Arch
 
     private void scanDir(File dir, List<String> classNames, String packageName) {
         File[] files = dir.listFiles();
+        // using /tmp/. as dir we can get null
+        if (files == null) {
+            return;
+        }
         for (File file : files) {
             if (file.isDirectory()) {
                 scanDir(file, classNames, packageName + file.getName() + ".");

Modified: geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/archive/FileArchiveTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/archive/FileArchiveTest.java?rev=1778104&r1=1778103&r2=1778104&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/archive/FileArchiveTest.java
(original)
+++ geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/archive/FileArchiveTest.java
Tue Jan 10 10:05:25 2017
@@ -19,7 +19,6 @@ package org.apache.xbean.finder.archive;
 import org.acme.foo.Blue;
 import org.acme.foo.Green;
 import org.acme.foo.Red;
-import org.junit.Assert;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;



Mime
View raw message