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

ludovicp
27.10.2010 03fe0954e42abf00746b8efa4c79ee74cf514427
opends/src/server/org/opends/server/tools/LDAPPasswordModify.java
@@ -22,9 +22,10 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 */
package org.opends.server.tools;
import org.opends.admin.ads.util.ConnectionUtils;
import org.opends.messages.Message;
@@ -186,6 +187,7 @@
    StringArgument    sslKeyStorePIN;
    StringArgument    sslTrustStore;
    StringArgument    sslTrustStorePIN;
    IntegerArgument   connectTimeout;
    StringArgument    propertiesFileArgument;
    BooleanArgument   noPropertiesFileArgument;
@@ -405,6 +407,16 @@
      controlStr.setPropertyName("control");
      argParser.addArgument(controlStr);
      int defaultTimeout = ConnectionUtils.getDefaultLDAPTimeout();
      connectTimeout = new IntegerArgument(OPTION_LONG_CONNECT_TIMEOUT,
          null, OPTION_LONG_CONNECT_TIMEOUT,
          false, false, true, INFO_TIMEOUT_PLACEHOLDER.get(),
          defaultTimeout, null,
          true, 0, false, Integer.MAX_VALUE,
          INFO_DESCRIPTION_CONNECTION_TIMEOUT.get());
      connectTimeout.setPropertyName(OPTION_LONG_CONNECT_TIMEOUT);
      argParser.addArgument(connectTimeout);
      showUsage = new BooleanArgument("help", OPTION_SHORT_HELP,
                                      OPTION_LONG_HELP,
@@ -665,7 +677,8 @@
    try
    {
      connection.connectToHost(dn, pw, nextMessageID);
      int timeout = connectTimeout.getIntValue();
      connection.connectToHost(dn, pw, nextMessageID, timeout);
    }
    catch (LDAPConnectionException lce)
    {
@@ -673,6 +686,13 @@
      err.println(wrapText(message, MAX_LINE_WIDTH));
      return lce.getResultCode();
    }
    catch (ArgumentException e)
    {
      // This should not occur because the arguments are already parsed.
      // It is a bug
      e.printStackTrace();
      throw new IllegalStateException("Unexpected error: "+e, e);
    }
    LDAPReader reader = connection.getLDAPReader();
    LDAPWriter writer = connection.getLDAPWriter();