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:
David Pursehouse
2018-08-02 11:30:11 +02:00
parent dc1d42d2f6
commit ba1151c20d
2 changed files with 4 additions and 4 deletions

View File

@@ -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);

View File

@@ -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);