Merge "Removed unused private variable containerAwareRegistration - please review...
[controller.git] / opendaylight / sal / yang-prototype / code-generator / maven-yang-plugin / src / main / java / org / opendaylight / controller / yang2sources / plugin / Util.java
index 3739a1d6599184898a6b64548e86208c634f572d..5676530afec2eaecedab1469608654abb3ebc675 100644 (file)
@@ -45,10 +45,15 @@ final class Util {
      * List files recursively and return as array of String paths. Use cache of
      * size 1.
      */
-    static Collection<File> listFiles(String rootDir) {
+    static Collection<File> listFiles(String rootDir) throws FileNotFoundException {
         if (cache.get(rootDir) != null)
             return cache.get(rootDir);
 
+        File file = new File(rootDir);
+        if(!file.exists()) {
+            throw new FileNotFoundException();
+        }
+
         Collection<File> yangFiles = FileUtils.listFiles(new File(rootDir),
                 new String[] { YANG_SUFFIX }, true);
 
@@ -67,7 +72,7 @@ final class Util {
         return is;
     }
 
-    static String[] listFilesAsArrayOfPaths(String rootDir) {
+    static String[] listFilesAsArrayOfPaths(String rootDir) throws FileNotFoundException {
         String[] filesArray = new String[] {};
         Collection<File> yangFiles = listFiles(rootDir);