in src/main/java/com/awsblog/queueing/utils/CommandLineUtils.java [32:71]
private void parse(String[] argv) {
if (argv == null || argv.length == 0) return;
for(String arg : argv) {
String option = arg.trim();
int totalDashes = 0;
if (option.startsWith("-")) {
for(int i = 0; i < option.length(); ++i) {
char ch = option.charAt(i);
if (ch == '-') {
++totalDashes;
continue;
}
if (Character.isUpperCase(ch) || Character.isLowerCase(ch)) break;
Utils.throwIfConditionIsTrue(true, "Invalid character used in the Command Line option key!");
}
Utils.throwIfConditionIsTrue(totalDashes == 0, "Option key needs to start with dashes!");
String[] arr = option.substring(totalDashes).split("=");
if (arr.length == 0 || Utils.checkIfNullOrEmptyString(arr[0])) {
if (arr.length == 1) System.out.printf("*** ERROR *** Command line parameters are invalid! [0] -> [%s]%n", arr[0]);
Utils.throwIfConditionIsTrue(true, "Invalid parameters!");
}
if (arr.length == 2) this.options.put(arr[0], arr[1]);
else this.options.put(arr[0], "");
}
}
}