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

jvergara
08.01.2007 e24804a9de2898416d5607f4ffead64808d46ecd
Fix for issue 2575.

The problem is that there is a timeout when reading the monitoring informations
on the server and the code did not handle this properly.

I have made the method Utils.getMessage to handle properly the case when a Topol
ogyCacheException has not a Throwable cause. In addition to that the method ret
urns a specific message when a timeout occurs. Finally the timeout thresold has
been risen from 10 to 30 seconds to be able to read the topology.

4 files modified
24 ■■■■ changed files
opends/src/ads/org/opends/admin/ads/TopologyCache.java 2 ●●● patch | view | raw | blame | history
opends/src/ads/org/opends/admin/ads/util/ServerLoader.java 5 ●●●● patch | view | raw | blame | history
opends/src/messages/messages/quicksetup.properties 1 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/util/Utils.java 16 ●●●● patch | view | raw | blame | history
opends/src/ads/org/opends/admin/ads/TopologyCache.java
@@ -59,7 +59,7 @@
  private Set<SuffixDescriptor> suffixes = new HashSet<SuffixDescriptor>();
  private final boolean isMultiThreaded = true;
  private final static int MULTITHREAD_TIMEOUT = 10000;
  private final static int MULTITHREAD_TIMEOUT = 30000;
  private static final Logger LOG =
    Logger.getLogger(TopologyCache.class.getName());
opends/src/ads/org/opends/admin/ads/util/ServerLoader.java
@@ -34,6 +34,7 @@
import javax.naming.AuthenticationException;
import javax.naming.NamingException;
import javax.naming.NoPermissionException;
import javax.naming.TimeLimitExceededException;
import javax.naming.ldap.InitialLdapContext;
import javax.naming.ldap.LdapName;
@@ -124,7 +125,9 @@
        ldapUrl = getLdapUrl(serverProperties);
      }
      lastException = new TopologyCacheException(
          TopologyCacheException.Type.TIMEOUT, null, trustManager, ldapUrl);
          TopologyCacheException.Type.TIMEOUT,
          new TimeLimitExceededException("Timeout reading server: "+ldapUrl),
          trustManager, ldapUrl);
      LOG.log(Level.WARNING, "Timeout reading server: "+ldapUrl);
    }
    super.interrupt();
opends/src/messages/messages/quicksetup.properties
@@ -291,6 +291,7 @@
INFO_ERROR_CONFIGURING_REMOTE_GENERIC=An unexpected error occurred \
 configuring server %s.%nThe error is: %s
INFO_ERROR_CONNECTING_TO_LOCAL=An error occurred connecting to the server.
INFO_ERROR_CONNECTING_TIMEOUT=The connection with the server timed out.
INFO_ERROR_COPYING=An unexpected error occurred extracting file %s.
INFO_ERROR_COPYING_FILE=Error copying file %s to %s.
INFO_ERROR_COULD_NOT_CREATE_PARENT_DIR=Could not create parent directory %s. \
opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -684,15 +684,27 @@
      buf.append(INFO_SERVER_ERROR.get(hostName));
      buf.append(" ");
    }
    if (te.getCause() instanceof NamingException)
    if (te.getType() == TopologyCacheException.Type.TIMEOUT)
    {
      buf.append(INFO_ERROR_CONNECTING_TIMEOUT.get());
    }
    else if (te.getCause() instanceof NamingException)
    {
      buf.append(getThrowableMsg(INFO_ERROR_CONNECTING_TO_LOCAL.get(),
          te.getCause()));
    }
    else
    {
      LOG.log(Level.WARNING, "Unexpected error: "+te, te);
      // This is unexpected.
      buf.append(getThrowableMsg(INFO_BUG_MSG.get(), te.getCause()));
      if (te.getCause() != null)
      {
        buf.append(getThrowableMsg(INFO_BUG_MSG.get(), te.getCause()));
      }
      else
      {
        buf.append(getThrowableMsg(INFO_BUG_MSG.get(), te));
      }
    }
    return buf.toMessage();
  }