options validation: --input-stdin requires --system-id
authorFrantišek Kučera <franta-hg@frantovo.cz>
Wed, 03 Sep 2014 15:50:16 +0200
changeset 58c11792ae6489
parent 57 88836193c9ba
child 59 12b4c1fc57a8
options validation: --input-stdin requires --system-id
java/alt2xml-cli/src/cz/frantovo/alt2xml/cli/CLIOptions.java
java/alt2xml-cli/src/cz/frantovo/alt2xml/cli/CLIStarter.java
     1.1 --- a/java/alt2xml-cli/src/cz/frantovo/alt2xml/cli/CLIOptions.java	Wed Jul 09 00:20:49 2014 +0200
     1.2 +++ b/java/alt2xml-cli/src/cz/frantovo/alt2xml/cli/CLIOptions.java	Wed Sep 03 15:50:16 2014 +0200
     1.3 @@ -46,6 +46,10 @@
     1.4  
     1.5  	public void validate() throws InvalidOptionsException {
     1.6  		InvalidOptionsException e = new InvalidOptionsException();
     1.7 +		
     1.8 +		if (inputFile == null && systemId == null) {
     1.9 +			e.addProblem(new InvalidOptionsException.OptionProblem("Please specify also systemId when reading from a stream (like STDIN) instead of from a file."));
    1.10 +		}
    1.11  
    1.12  		/**
    1.13  		 * TODO: validate
     2.1 --- a/java/alt2xml-cli/src/cz/frantovo/alt2xml/cli/CLIStarter.java	Wed Jul 09 00:20:49 2014 +0200
     2.2 +++ b/java/alt2xml-cli/src/cz/frantovo/alt2xml/cli/CLIStarter.java	Wed Sep 03 15:50:16 2014 +0200
     2.3 @@ -58,6 +58,8 @@
     2.4  		try {
     2.5  			CLIParser cliParser = new CLIParser();
     2.6  			CLIOptions cliOptions = cliParser.parseOptions(args);
     2.7 +			
     2.8 +			cliOptions.validate();
     2.9  
    2.10  			Map<String, ActionFactory> actionFactories = new HashMap<>();
    2.11