Merge "Statistics Northbound Test"
[controller.git] / opendaylight / sal / yang-prototype / code-generator / maven-yang-plugin / src / main / java / org / opendaylight / controller / yang2sources / plugin / Util.java
index 3739a1d6599184898a6b64548e86208c634f572d..acde15ef2afacc334c1800c03c9af79125a75208 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(rootDir);
+        }
+
         Collection<File> yangFiles = FileUtils.listFiles(new File(rootDir),
                 new String[] { YANG_SUFFIX }, true);
 
@@ -56,8 +61,8 @@ final class Util {
         return yangFiles;
     }
 
-    static Collection<InputStream> listFilesAsStream(String rootDir) throws FileNotFoundException {
-        Collection<InputStream> is = new ArrayList<InputStream>();
+    static List<InputStream> listFilesAsStream(String rootDir) throws FileNotFoundException {
+        List<InputStream> is = new ArrayList<InputStream>();
 
         Collection<File> files = listFiles(rootDir);
         for(File f : files) {
@@ -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);