From 8c6bdac558e66f42ece574fb00ef8224b3ffca07 Mon Sep 17 00:00:00 2001
From: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Date: Thu, 09 Apr 2026 18:06:26 +0000
Subject: [PATCH] Merge remote-tracking branch 'origin/copilot/fix-status-cli-argument-parsing' into copilot/add-hostname-trustall-status-commands # Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.

---
 opendj-server-legacy/src/main/java/org/opends/server/tools/status/StatusCli.java               |   16 +++++++++++-----
 opendj-server-legacy/src/main/java/org/opends/server/tools/status/StatusCliArgumentParser.java |    2 --
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/status/StatusCli.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/status/StatusCli.java
index e0f7146..390e8ba 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/status/StatusCli.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/status/StatusCli.java
@@ -246,14 +246,20 @@
       // LDAPConnectionConsoleInteraction, this done, it will not prompt
       // the user for them.
       controlInfo.setConnectionPolicy(ConnectionProtocolPolicy.USE_ADMIN);
-      int port = controlInfo.getAdminConnectorHostPort().getPort();
       final SecureConnectionCliArgs secureArgsList = argParser.getSecureArgsList();
       final StringArgument hostNameArg = secureArgsList.getHostNameArg();
-      hostNameArg.setPresent(true);
-      hostNameArg.addValue(hostNameArg.getDefaultValue());
+      if (!hostNameArg.isPresent())
+      {
+        hostNameArg.setPresent(true);
+        hostNameArg.addValue(hostNameArg.getDefaultValue());
+      }
       final IntegerArgument portArg = secureArgsList.getPortArg();
-      portArg.setPresent(true);
-      portArg.addValue(Integer.toString(port));
+      if (!portArg.isPresent())
+      {
+        int port = controlInfo.getAdminConnectorHostPort().getPort();
+        portArg.setPresent(true);
+        portArg.addValue(Integer.toString(port));
+      }
       // We already know if SSL or StartTLS can be used.  If we cannot
       // use them we will not propose them in the connection parameters
       // and if none of them can be used we will just not ask for the
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/status/StatusCliArgumentParser.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/status/StatusCliArgumentParser.java
index 1a508e8..997898f 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/status/StatusCliArgumentParser.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/status/StatusCliArgumentParser.java
@@ -78,8 +78,6 @@
   throws ArgumentException
   {
     ArrayList<Argument> defaultArgs = new ArrayList<>(createGlobalArguments(outStream, alwaysSSL));
-    defaultArgs.remove(secureArgsList.getPortArg());
-    defaultArgs.remove(secureArgsList.getHostNameArg());
     defaultArgs.remove(verboseArg);
     defaultArgs.remove(noPropertiesFileArg);
     defaultArgs.remove(propertiesFileArg);

--
Gitblit v1.10.0