[Bugfix] fixed NPE when CLI argument is missing
This commit is contained in:
parent
a7e4faa5c1
commit
c1a84fc480
|
@ -39,13 +39,17 @@ import org.slf4j.LoggerFactory;
|
||||||
public class MainStarter {
|
public class MainStarter {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(MainStarter.class);
|
private static final Logger logger = LoggerFactory.getLogger(MainStarter.class);
|
||||||
|
|
||||||
|
private static final String OPT_ROOT_PATH = "root-path";
|
||||||
|
|
||||||
private Options options;
|
private Options options;
|
||||||
private StrolchAgent agent;
|
private StrolchAgent agent;
|
||||||
|
|
||||||
public MainStarter() {
|
public MainStarter() {
|
||||||
Options op = new Options();
|
Options op = new Options();
|
||||||
Option rootPathOption = new Option("p", "root-path", true, "root path to strolch runtime");
|
Option rootPathOption = new Option("p", OPT_ROOT_PATH, true, "root path to strolch runtime");
|
||||||
rootPathOption.setOptionalArg(false);
|
rootPathOption.setOptionalArg(false);
|
||||||
|
rootPathOption.setRequired(true);
|
||||||
op.addOption(rootPathOption);
|
op.addOption(rootPathOption);
|
||||||
this.options = op;
|
this.options = op;
|
||||||
}
|
}
|
||||||
|
@ -65,7 +69,7 @@ public class MainStarter {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
String pathS = line.getOptionValue("root-path");
|
String pathS = line.getOptionValue(OPT_ROOT_PATH);
|
||||||
File pathF = new File(pathS);
|
File pathF = new File(pathS);
|
||||||
if (!pathF.exists()) {
|
if (!pathF.exists()) {
|
||||||
logger.info(MessageFormat.format("Path parameter does not exist at: {0}", pathS));
|
logger.info(MessageFormat.format("Path parameter does not exist at: {0}", pathS));
|
||||||
|
|
Loading…
Reference in New Issue