package org.opendaylight.yangtools.yang.validation.tool;
import java.io.File;
-import java.net.URISyntaxException;
-
import net.sourceforge.argparse4j.ArgumentParsers;
import net.sourceforge.argparse4j.annotation.Arg;
import net.sourceforge.argparse4j.inf.ArgumentParser;
import org.slf4j.LoggerFactory;
final class Params {
-
private static final Logger LOG = LoggerFactory.getLogger(Params.class);
+
@Arg(dest = "yang-source-dir")
private File yangSourceDir;
- static ArgumentParser getParser() throws URISyntaxException {
+ static ArgumentParser getParser() {
final ArgumentParser parser = ArgumentParsers.newArgumentParser("jar_file_name");
parser.description("Validation Tool for Yang Models")
.formatUsage();
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;
}