From 6fc41a1abb3d350db8646e0e39077e8190eb12ad Mon Sep 17 00:00:00 2001 From: Kai Hudalla Date: Sat, 28 Oct 2023 14:16:16 +0200 Subject: [PATCH] [#3576] Fix NPE when running CLI The AmqpAdapter and CommandAndControl classes have been changed to pass in a non-null ConfigurationPath when creating the JLine console builtins. Fixes #3576 --- .../java/org/eclipse/hono/cli/adapter/amqp/AmqpAdapter.java | 3 ++- .../main/java/org/eclipse/hono/cli/app/CommandAndControl.java | 3 ++- .../main/java/org/eclipse/hono/cli/util/ConnectionOptions.java | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cli/src/main/java/org/eclipse/hono/cli/adapter/amqp/AmqpAdapter.java b/cli/src/main/java/org/eclipse/hono/cli/adapter/amqp/AmqpAdapter.java index 84b3314da6..443afebaaf 100644 --- a/cli/src/main/java/org/eclipse/hono/cli/adapter/amqp/AmqpAdapter.java +++ b/cli/src/main/java/org/eclipse/hono/cli/adapter/amqp/AmqpAdapter.java @@ -41,6 +41,7 @@ import org.eclipse.hono.client.device.amqp.AmqpAdapterClient; import org.eclipse.hono.util.QoS; import org.fusesource.jansi.AnsiConsole; +import org.jline.builtins.ConfigurationPath; import org.jline.console.SystemRegistry; import org.jline.console.impl.Builtins; import org.jline.console.impl.SystemRegistryImpl; @@ -252,7 +253,7 @@ private void readAndExecuteCommands() { try { final Supplier workDir = () -> Paths.get(System.getProperty("user.dir")); // set up JLine built-in commands - final var builtins = new Builtins(workDir, null, null); + final var builtins = new Builtins(workDir, new ConfigurationPath(null, null), null); builtins.rename(Builtins.Command.TTOP, "top"); builtins.alias("zle", "widget"); builtins.alias("bindkey", "keymap"); diff --git a/cli/src/main/java/org/eclipse/hono/cli/app/CommandAndControl.java b/cli/src/main/java/org/eclipse/hono/cli/app/CommandAndControl.java index c5e0c03472..57ba077235 100644 --- a/cli/src/main/java/org/eclipse/hono/cli/app/CommandAndControl.java +++ b/cli/src/main/java/org/eclipse/hono/cli/app/CommandAndControl.java @@ -34,6 +34,7 @@ import org.eclipse.hono.util.Constants; import org.eclipse.hono.util.MessageHelper; import org.fusesource.jansi.AnsiConsole; +import org.jline.builtins.ConfigurationPath; import org.jline.console.SystemRegistry; import org.jline.console.impl.Builtins; import org.jline.console.impl.SystemRegistryImpl; @@ -162,7 +163,7 @@ private void readAndExecuteCommands() { try { final Supplier workDir = () -> Paths.get(System.getProperty("user.dir")); // set up JLine built-in commands - final var builtins = new Builtins(workDir, null, null); + final var builtins = new Builtins(workDir, new ConfigurationPath(null, null), null); builtins.rename(Builtins.Command.TTOP, "top"); builtins.alias("zle", "widget"); builtins.alias("bindkey", "keymap"); diff --git a/cli/src/main/java/org/eclipse/hono/cli/util/ConnectionOptions.java b/cli/src/main/java/org/eclipse/hono/cli/util/ConnectionOptions.java index 5b7d7fb83b..afb7accc95 100644 --- a/cli/src/main/java/org/eclipse/hono/cli/util/ConnectionOptions.java +++ b/cli/src/main/java/org/eclipse/hono/cli/util/ConnectionOptions.java @@ -59,7 +59,7 @@ public class ConnectionOptions { names = { "--ca-file" }, description = { "Absolute path to a file containing trusted CA certificates to enable encrypted communication.", - "If not set explicitly, the platform's default trust store will be used." + "This option is required for connecting to endpoints using TLS." }, order = 4) public Optional trustStorePath;