diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/InputAbstract.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/InputAbstract.java index 5625c9ddc5..8c072fab18 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/InputAbstract.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/InputAbstract.java @@ -63,13 +63,21 @@ public class InputAbstract extends ActionAbstract { return silentDefault; } - String inputStr; + String inputStr = ""; boolean valid = false; System.out.println(); do { context.out.println(propertyName + ": is mandatory with this configuration:"); context.out.println(prompt); - inputStr = new String(System.console().readPassword()); + char[] chars = System.console().readPassword(); + + // could be null if the user input something weird like Ctrl-d + if (chars == null) { + System.out.println("Invalid Entry!"); + continue; + } + + inputStr = new String(chars); if (inputStr.trim().equals("")) { System.out.println("Invalid Entry!");