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

lutoff
14.09.2007 390948050c34e7ed6668059ccdb4af27b4204fd9
Fix for issue #2256 (limit the number of prompt in status CLI)
status cli will now exit after 3 connection failure.
2 files modified
22 ■■■■■ changed files
opends/src/guitools/org/opends/guitools/statuspanel/StatusCli.java 21 ●●●●● patch | view | raw | blame | history
opends/src/messages/messages/admin_tool.properties 1 ●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/statuspanel/StatusCli.java
@@ -85,6 +85,9 @@
  /** Suffix for log files. */
  static public final String LOG_FILE_SUFFIX = ".log";
  /** Maximum number of connection attempts. */
  private final int MAX_CONNECTION_RETRY =3;
  /**
   * The enumeration containing the different return codes that the command-line
   * can have.
@@ -112,7 +115,11 @@
    /**
     * User cancelled (for instance not accepting the certificate proposed).
     */
    USER_CANCELLED(3);
    USER_CANCELLED(3),
    /**
     * Too many connection failure.
     */
   ERROR_TOO_MANY_CONNECTION_FAILURE(4);
    private int returnCode;
    private ErrorReturnCode(int returnCode)
@@ -350,8 +357,10 @@
            }
            InitialLdapContext ctx = null;
            while (!connected && !cancelled)
            int remainingRetry = MAX_CONNECTION_RETRY;
            while (!connected && !cancelled && (remainingRetry > 0))
            {
             remainingRetry--;
              if (prompted)
              {
                printLineBreak();
@@ -446,6 +455,14 @@
            {
              return ErrorReturnCode.USER_CANCELLED.getReturnCode();
            }
            else
            if (remainingRetry <= 0)
            {
              printErrorMessage(
                  ERR_STATUS_CLI_TOO_MANY_CONNECTION_ATTEMPT.get());
              return ErrorReturnCode.ERROR_TOO_MANY_CONNECTION_FAILURE
                  .getReturnCode();
            }
          }
          else
          {
opends/src/messages/messages/admin_tool.properties
@@ -533,6 +533,7 @@
MILD_ERR_STATUS_CLI_ERROR_CONNECTING_PROMPT_AGAIN=Could not connect to the \
 Directory Server with the provided credentials.%nError details: %s%nProvide \
 again the required information to connect to the server:
SEVERE_ERR_STATUS_CLI_TOO_MANY_CONNECTION_ATTEMPT=Too many authentication failures - Exit
INFO_REPLICATION_ENABLE_HOSTNAME1_PROMPT=Host name of the first server
INFO_REPLICATION_ENABLE_PORT1_PROMPT=LDAP port of the first server
INFO_REPLICATION_ENABLE_REPLICATIONPORT1_PROMPT=Replication port for the first \