diff --git a/core/src/main/java/org/elasticsearch/common/settings/AddStringKeyStoreCommand.java b/core/src/main/java/org/elasticsearch/common/settings/AddStringKeyStoreCommand.java index 7ac78c15b9a..1074f2ac552 100644 --- a/core/src/main/java/org/elasticsearch/common/settings/AddStringKeyStoreCommand.java +++ b/core/src/main/java/org/elasticsearch/common/settings/AddStringKeyStoreCommand.java @@ -64,6 +64,9 @@ class AddStringKeyStoreCommand extends EnvironmentAwareCommand { keystore.decrypt(new char[0] /* TODO: prompt for password when they are supported */); String setting = arguments.value(options); + if (setting == null) { + throw new UserException(ExitCodes.DATA_ERROR, "the setting name can not be null."); + } if (keystore.getSettings().contains(setting) && options.has(forceOption) == false) { if (terminal.promptYesNo("Setting " + setting + " already exists. Overwrite?", false) == false) { terminal.println("Exiting without modifying keystore.");