From de702f2eb5e9275523f9d1b2f31342c99e67c479 Mon Sep 17 00:00:00 2001 From: Sally MacFarlane Date: Mon, 17 Feb 2020 20:08:51 +1000 Subject: [PATCH] parse args and validate before any setup Signed-off-by: Sally MacFarlane --- .../main/java/tech/pegasys/ethsigner/CommandlineParser.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ethsigner/commandline/src/main/java/tech/pegasys/ethsigner/CommandlineParser.java b/ethsigner/commandline/src/main/java/tech/pegasys/ethsigner/CommandlineParser.java index 8c6163ac1..aa7010cad 100644 --- a/ethsigner/commandline/src/main/java/tech/pegasys/ethsigner/CommandlineParser.java +++ b/ethsigner/commandline/src/main/java/tech/pegasys/ethsigner/CommandlineParser.java @@ -59,8 +59,10 @@ public boolean parseCommandLine(final String... args) { } try { - commandLine.parseWithHandlers(new RunLast().useOut(output), new ExceptionHandler<>(), args); + // parseArgs ensures all args are populated and can then be validated prior to any setup + commandLine.parseArgs(args); baseCommand.validateOptions(commandLine, LOG); + commandLine.parseWithHandlers(new RunLast().useOut(output), new ExceptionHandler<>(), args); return true; } catch (final ParameterException ex) { handleParameterException(ex);