Merge "Error out when given an unknown argument"
This commit is contained in:
commit
3a4f6b53c4
1 changed files with 5 additions and 2 deletions
|
@ -105,7 +105,8 @@ public class DictionaryMaker {
|
||||||
} else {
|
} else {
|
||||||
// All these options need an argument
|
// All these options need an argument
|
||||||
if (args.isEmpty()) {
|
if (args.isEmpty()) {
|
||||||
throw new RuntimeException("Option " + arg + " requires an argument");
|
throw new IllegalArgumentException("Option " + arg + " is unknown or "
|
||||||
|
+ "requires an argument");
|
||||||
}
|
}
|
||||||
String filename = args.get(0);
|
String filename = args.get(0);
|
||||||
args.remove(0);
|
args.remove(0);
|
||||||
|
@ -121,6 +122,8 @@ public class DictionaryMaker {
|
||||||
outputBinary = filename;
|
outputBinary = filename;
|
||||||
} else if (OPTION_OUTPUT_XML.equals(arg)) {
|
} else if (OPTION_OUTPUT_XML.equals(arg)) {
|
||||||
outputXml = filename;
|
outputXml = filename;
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException("Unknown option : " + arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -133,7 +136,7 @@ public class DictionaryMaker {
|
||||||
} else if (null == outputBinary) {
|
} else if (null == outputBinary) {
|
||||||
outputBinary = arg;
|
outputBinary = arg;
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("Several output binary files specified");
|
throw new IllegalArgumentException("Several output binary files specified");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue