From 1cf1b22e8cedd6e8439f5bd5db619b5ff783aa7b Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Thu, 08 Nov 2007 11:01:30 +0000
Subject: [PATCH] Fix for issue 2575.

---
 opendj-sdk/opends/src/ads/org/opends/admin/ads/TopologyCache.java      |    2 +-
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java |   16 ++++++++++++++--
 opendj-sdk/opends/src/ads/org/opends/admin/ads/util/ServerLoader.java  |    5 ++++-
 opendj-sdk/opends/src/messages/messages/quicksetup.properties          |    1 +
 4 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/opendj-sdk/opends/src/ads/org/opends/admin/ads/TopologyCache.java b/opendj-sdk/opends/src/ads/org/opends/admin/ads/TopologyCache.java
index 798ef62..dba380c 100644
--- a/opendj-sdk/opends/src/ads/org/opends/admin/ads/TopologyCache.java
+++ b/opendj-sdk/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());
diff --git a/opendj-sdk/opends/src/ads/org/opends/admin/ads/util/ServerLoader.java b/opendj-sdk/opends/src/ads/org/opends/admin/ads/util/ServerLoader.java
index 8ca9732..4fa3c75 100644
--- a/opendj-sdk/opends/src/ads/org/opends/admin/ads/util/ServerLoader.java
+++ b/opendj-sdk/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();
diff --git a/opendj-sdk/opends/src/messages/messages/quicksetup.properties b/opendj-sdk/opends/src/messages/messages/quicksetup.properties
index c9fea42..4d2c5e1 100644
--- a/opendj-sdk/opends/src/messages/messages/quicksetup.properties
+++ b/opendj-sdk/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. \
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
index fed0bfe..a50ccf5 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
+++ b/opendj-sdk/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();
   }

--
Gitblit v1.10.0