AsciiDoctor, DocIndexer: Don't use deprecated CmdLineException
These classes don't really need to throw a CmdLineException because the provided CmdLineParser is never actually used when reporting the error to the user. Replace the deprecated CmdLineException with IllegalArgumentException. Change-Id: I52efc3d70177cbaa4ae9c0d945b4afc558f504d2
This commit is contained in:
@@ -142,9 +142,9 @@ public class AsciiDoctor {
|
||||
try {
|
||||
parser.parseArgument(parameters);
|
||||
if (inputFiles.isEmpty()) {
|
||||
throw new CmdLineException(parser, "asciidoctor: FAILED: input file missing");
|
||||
throw new IllegalArgumentException("asciidoctor: FAILED: input file missing");
|
||||
}
|
||||
} catch (CmdLineException e) {
|
||||
} catch (CmdLineException | IllegalArgumentException e) {
|
||||
System.err.println(e.getMessage());
|
||||
parser.printUsage(System.err);
|
||||
System.exit(1);
|
||||
|
||||
@@ -72,9 +72,9 @@ public class DocIndexer {
|
||||
try {
|
||||
parser.parseArgument(parameters);
|
||||
if (inputFiles.isEmpty()) {
|
||||
throw new CmdLineException(parser, "FAILED: input file missing");
|
||||
throw new IllegalArgumentException("FAILED: input file missing");
|
||||
}
|
||||
} catch (CmdLineException e) {
|
||||
} catch (CmdLineException | IllegalArgumentException e) {
|
||||
System.err.println(e.getMessage());
|
||||
parser.printUsage(System.err);
|
||||
System.exit(1);
|
||||
|
||||
Reference in New Issue
Block a user