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

Jean-Noël Rouvignac
05.39.2016 609077ed606e3b094e303f298e8dca10567bc3e2
opendj-server-legacy/src/main/java/org/opends/quicksetup/util/ServerController.java
@@ -23,20 +23,19 @@
import java.util.List;
import java.util.Map;
import javax.naming.NamingException;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.LdapException;
import org.opends.admin.ads.util.ConnectionWrapper;
import org.opends.admin.ads.util.PreferredConnection.Type;
import org.opends.quicksetup.Application;
import org.opends.quicksetup.ApplicationException;
import org.opends.quicksetup.Configuration;
import org.opends.quicksetup.Installation;
import org.opends.quicksetup.ReturnCode;
import org.opends.quicksetup.installer.InstallerHelper;
import org.opends.server.types.HostPort;
import org.opends.server.util.SetupUtils;
import com.forgerock.opendj.cli.CliConstants;
@@ -45,6 +44,7 @@
import static com.forgerock.opendj.cli.Utils.*;
import static com.forgerock.opendj.util.OperatingSystem.*;
import static org.opends.admin.ads.util.PreferredConnection.Type.*;
import static org.opends.messages.QuickSetupMessages.*;
import static org.opends.server.util.CollectionUtils.*;
@@ -457,22 +457,17 @@
    for (int i=0; i<50 && !connected; i++)
    {
      String hostName = getHostName(i);
      String ldapUrl = "ldaps://"+hostName+":" + port;
      try
      int timeout = CliConstants.DEFAULT_LDAP_CONNECT_TIMEOUT;
      if (application != null && application.getUserData() != null)
      {
        int timeout = CliConstants.DEFAULT_LDAP_CONNECT_TIMEOUT;
        if (application != null && application.getUserData() != null)
        {
          timeout = application.getUserData().getConnectTimeout();
        }
        try (ConnectionWrapper conn =
            new ConnectionWrapper(ldapUrl, Type.LDAPS, userDn, userPw, timeout, null))
        {
          return;
        }
        timeout = application.getUserData().getConnectTimeout();
      }
      catch (NamingException ne)
      HostPort hp = new HostPort(getHostName(i), port);
      try (ConnectionWrapper conn = new ConnectionWrapper(hp, LDAPS, userDn, userPw, timeout, null))
      {
        return;
      }
      catch (LdapException ne)
      {
        logger.warn(LocalizableMessage.raw("Could not connect to server: "+ne, ne));
      }