mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Copilot
13 hours ago 541fa7a7c68fcc344997ee11cf70575f36b530d8
status CLI: allow --hostname, --port, and --trustAll arguments (#631)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: vharseko <6818498+vharseko@users.noreply.github.com>
2 files modified
20 ■■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/tools/status/StatusCli.java 17 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/status/StatusCliArgumentParser.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/status/StatusCli.java
@@ -13,6 +13,7 @@
 *
 * Copyright 2007-2010 Sun Microsystems, Inc.
 * Portions Copyright 2011-2016 ForgeRock AS.
 * Portions Copyright 2026 3A Systems, LLC.
 */
package org.opends.server.tools.status;
@@ -246,14 +247,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
opendj-server-legacy/src/main/java/org/opends/server/tools/status/StatusCliArgumentParser.java
@@ -13,6 +13,7 @@
 *
 * Copyright 2008-2009 Sun Microsystems, Inc.
 * Portions Copyright 2012-2016 ForgeRock AS.
 * Portions Copyright 2026 3A Systems, LLC.
 */
package org.opends.server.tools.status;
@@ -78,8 +79,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);