X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fsal%2Fyang-prototype%2Fcode-generator%2Fmaven-yang-plugin%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fyang2sources%2Fplugin%2FUtil.java;h=acde15ef2afacc334c1800c03c9af79125a75208;hb=66b4fbc0fd997591f71745f514013484abb30175;hp=3739a1d6599184898a6b64548e86208c634f572d;hpb=2a77046c0d95cb07a6c79881886a23f50252c207;p=controller.git diff --git a/opendaylight/sal/yang-prototype/code-generator/maven-yang-plugin/src/main/java/org/opendaylight/controller/yang2sources/plugin/Util.java b/opendaylight/sal/yang-prototype/code-generator/maven-yang-plugin/src/main/java/org/opendaylight/controller/yang2sources/plugin/Util.java index 3739a1d659..acde15ef2a 100644 --- a/opendaylight/sal/yang-prototype/code-generator/maven-yang-plugin/src/main/java/org/opendaylight/controller/yang2sources/plugin/Util.java +++ b/opendaylight/sal/yang-prototype/code-generator/maven-yang-plugin/src/main/java/org/opendaylight/controller/yang2sources/plugin/Util.java @@ -45,10 +45,15 @@ final class Util { * List files recursively and return as array of String paths. Use cache of * size 1. */ - static Collection listFiles(String rootDir) { + static Collection 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 yangFiles = FileUtils.listFiles(new File(rootDir), new String[] { YANG_SUFFIX }, true); @@ -56,8 +61,8 @@ final class Util { return yangFiles; } - static Collection listFilesAsStream(String rootDir) throws FileNotFoundException { - Collection is = new ArrayList(); + static List listFilesAsStream(String rootDir) throws FileNotFoundException { + List is = new ArrayList(); Collection 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 yangFiles = listFiles(rootDir);