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

Fabio Pistolesi
08.55.2016 f7940c5ab77e97f3df1eaa2cf27a2877a4f9593e
OPENDJ-2829 dsreplication status throws a NPE when the server is not running

Before wrapping a connection context, it has to be valid. Some tests were
missing.
1 files modified
18 ■■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliMain.java 18 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliMain.java
@@ -1599,14 +1599,17 @@
  {
    try
    {
      return new ConnectionWrapper(createAdministrativeContext(uData, bindDn),
          getConnectTimeout(), getTrustManager(sourceServerCI));
      InitialLdapContext ctx = createAdministrativeContext(uData, bindDn);
      if (ctx != null)
      {
        return new ConnectionWrapper(ctx, getConnectTimeout(), getTrustManager(sourceServerCI));
      }
    }
    catch (NamingException e)
    {
      logger.error(LocalizableMessage.raw("Error when creating connection for:" + uData.getHostPort()));
      return null;
    }
    return null;
  }
  private InitialLdapContext createAdministrativeContext(MonoServerReplicationUserData uData, final String bindDn)
@@ -4176,14 +4179,17 @@
  {
    try
    {
      return new ConnectionWrapper(createAdministrativeContext(server, errorMessages),
          getConnectTimeout(), getTrustManager(sourceServerCI));
      InitialLdapContext ctx = createAdministrativeContext(server, errorMessages);
      if (ctx != null)
      {
        return new ConnectionWrapper(ctx, getConnectTimeout(), getTrustManager(sourceServerCI));
      }
    }
    catch (NamingException e)
    {
      logger.error(LocalizableMessage.raw("Error when creating connection for:" + server.getHostPort()));
      return null;
    }
    return null;
  }
  private InitialLdapContext createAdministrativeContext(EnableReplicationServerData server,