CmdLineParser parser = new CmdLineParser(arguments);
try {
parser.parseArgument(args);
arguments.cmdLineParser = parser;
if (Strings2.isEmpty(arguments.pid) && arguments.pidFile == null) {
throw new CmdLineException(parser, "Options --pid and --pid-file can NOT be both null");
} else if (!Strings2.isEmpty(arguments.pid) && arguments.pidFile != null) {
throw new CmdLineException(parser, "Options --pid and --pid-file can NOT be both defined");
} else if (
(arguments.attribute == null || arguments.attribute.length == 0) &&
(arguments.operation == null || arguments.operation.length == 0) &&
arguments.listMbeans == false && arguments.describeMbeans == false) {
throw new CmdLineException(parser, "Option --attribute or --operation or --list-mbeans or --describe-mbeans must be defined");
} else if (
(arguments.attribute != null && arguments.attribute.length > 0) &&
(arguments.operation != null && arguments.operation.length > 0)) {
throw new CmdLineException(parser, "Options --attribute and --operation can NOT be both defined");
}
String logLevel;
if (arguments.superVerbose) {