Enable SpotBugs enforcement in yang-validation-tool
[yangtools.git] / yang-validation-tool / src / main / java / org / opendaylight / yangtools / yang / validation / tool / Params.java
index 82b92cfceab90200c435c3ac2c20606a62563da1..aab1789532b1333a213788b2d7f303d462b2131d 100644 (file)
@@ -15,8 +15,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 final class Params {
-
     private static final Logger LOG = LoggerFactory.getLogger(Params.class);
+
     @Arg(dest = "yang-source-dir")
     private File yangSourceDir;
 
@@ -48,7 +48,12 @@ final class Params {
             LOG.error("Yang source directory has to be readable");
             return false;
         }
-        if (yangSourceDir.list().length == 0) {
+        final String[] listed = yangSourceDir.list();
+        if (listed == null) {
+            LOG.error("Yang source directory {} is not a directory or cannot be read", yangSourceDir.getPath());
+            return false;
+        }
+        if (listed.length == 0) {
             LOG.error("Yang source directory {} doesn't contain any model", yangSourceDir.getPath());
             return false;
         }