From ed1c23f62597ba2fcf725b480289f95a55b0c1ff Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 21 Sep 2007 18:09:24 +0000
Subject: [PATCH] Fix for 2320.

---
 opends/src/messages/messages/quicksetup.properties                             |    6 +-
 opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliMain.java |    4 +-
 opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java           |   42 +++++++++++++++------
 opends/src/quicksetup/org/opends/quicksetup/Application.java                   |   16 ++++++--
 4 files changed, 47 insertions(+), 21 deletions(-)

diff --git a/opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliMain.java b/opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliMain.java
index 5ff5261..9c74d3e 100644
--- a/opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliMain.java
+++ b/opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliMain.java
@@ -4163,12 +4163,12 @@
     if (Utils.isCertificateException(ne))
     {
       msg = INFO_ERROR_READING_CONFIG_LDAP_CERTIFICATE_SERVER.get(
-              hostPort, ne.toString());
+              hostPort, ne.toString(true));
     }
     else
     {
        msg = INFO_CANNOT_CONNECT_TO_REMOTE_GENERIC.get(
-          hostPort, ne.toString());
+          hostPort, ne.toString(true));
     }
     return msg;
   }
diff --git a/opends/src/messages/messages/quicksetup.properties b/opends/src/messages/messages/quicksetup.properties
index 9dac254..e69cf1b 100644
--- a/opends/src/messages/messages/quicksetup.properties
+++ b/opends/src/messages/messages/quicksetup.properties
@@ -79,9 +79,9 @@
  the rights to access it.
 INFO_CANNOT_CONNECT_TO_REMOTE_AUTHENTICATION=The provided credentials are not \
  valid.
-INFO_CANNOT_CONNECT_TO_REMOTE_GENERIC=Could not connect to %s. The error \
- message received is:%n%s%nCheck that the server is running and that the \
- provided credentials are valid.
+INFO_CANNOT_CONNECT_TO_REMOTE_GENERIC=Could not connect to %s.  Check that the \
+ server is running and that the provided credentials are valid.%nError \
+ details:%n%s
 INFO_CANNOT_CONNECT_TO_REMOTE_PERMISSIONS=You do not have enough access \
  rights to read the configuration in %s. %nProvide credentials with enough \
  rights.
diff --git a/opends/src/quicksetup/org/opends/quicksetup/Application.java b/opends/src/quicksetup/org/opends/quicksetup/Application.java
index 47e7733..4a38ae3 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/Application.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/Application.java
@@ -719,10 +719,18 @@
     }
     catch (NamingException ne)
     {
-      Message errorMessage = INFO_CANNOT_CONNECT_TO_REMOTE_GENERIC.get(
-          server.getHostPort(true), ne.toString(true));
-      throw new ApplicationException(
-          ReturnCode.CONFIGURATION_ERROR, errorMessage,
+      Message msg;
+      if (Utils.isCertificateException(ne))
+      {
+        msg = INFO_ERROR_READING_CONFIG_LDAP_CERTIFICATE_SERVER.get(
+            server.getHostPort(true), ne.toString(true));
+      }
+      else
+      {
+         msg = INFO_CANNOT_CONNECT_TO_REMOTE_GENERIC.get(
+             server.getHostPort(true), ne.toString(true));
+      }
+      throw new ApplicationException(ReturnCode.CONFIGURATION_ERROR, msg,
           ne);
     }
     return ctx;
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java b/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
index 1976f23..d90c04b 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -61,6 +61,8 @@
 import org.opends.admin.ads.TopologyCacheException;
 import org.opends.admin.ads.util.ApplicationTrustManager;
 import org.opends.quicksetup.ui.*;
+import org.opends.quicksetup.util.Utils;
+
 import static org.opends.quicksetup.util.Utils.*;
 import static org.opends.quicksetup.Step.*;
 import org.opends.quicksetup.*;
@@ -1801,11 +1803,19 @@
       }
       catch (NamingException ne)
       {
-        throw new ApplicationException(
-                ReturnCode.CONFIGURATION_ERROR,
-                INFO_CANNOT_CONNECT_TO_REMOTE_GENERIC.get(
-                        server.getHostPort(true),
-                        ne.getLocalizedMessage()), ne);
+        Message msg;
+        if (Utils.isCertificateException(ne))
+        {
+          msg = INFO_ERROR_READING_CONFIG_LDAP_CERTIFICATE_SERVER.get(
+              server.getHostPort(true), ne.toString(true));
+        }
+        else
+        {
+           msg = INFO_CANNOT_CONNECT_TO_REMOTE_GENERIC.get(
+               server.getHostPort(true), ne.toString(true));
+        }
+        throw new ApplicationException(ReturnCode.CONFIGURATION_ERROR, msg,
+            ne);
       }
       finally
       {
@@ -1857,11 +1867,19 @@
           }
           catch (NamingException ne)
           {
-            throw new ApplicationException(
-                ReturnCode.CONFIGURATION_ERROR,
-                INFO_CANNOT_CONNECT_TO_REMOTE_GENERIC.get(
-                        server.getHostPort(true),
-                        ne.getLocalizedMessage()), ne);
+            Message msg;
+            if (Utils.isCertificateException(ne))
+            {
+              msg = INFO_ERROR_READING_CONFIG_LDAP_CERTIFICATE_SERVER.get(
+                  server.getHostPort(true), ne.toString(true));
+            }
+            else
+            {
+               msg = INFO_CANNOT_CONNECT_TO_REMOTE_GENERIC.get(
+                   server.getHostPort(true), ne.toString(true));
+            }
+            throw new ApplicationException(ReturnCode.CONFIGURATION_ERROR, msg,
+                ne);
           }
           finally
           {
@@ -2096,7 +2114,7 @@
         throw new ApplicationException(
                 ReturnCode.CONFIGURATION_ERROR,
                 INFO_CANNOT_CONNECT_TO_REMOTE_GENERIC.get(
-                        getHostDisplay(auth), ne.getLocalizedMessage()), ne);
+                        getHostDisplay(auth), ne.toString(true)), ne);
       }
       else
       {
@@ -3008,7 +3026,7 @@
       else if (t instanceof NamingException)
       {
         errorMsgs.add(INFO_CANNOT_CONNECT_TO_REMOTE_GENERIC.get(
-                host+":"+port, t.toString()));
+                host+":"+port, ((NamingException)t).toString(true)));
         qs.displayFieldInvalid(FieldName.REMOTE_SERVER_HOST, true);
         qs.displayFieldInvalid(FieldName.REMOTE_SERVER_PORT, true);
         qs.displayFieldInvalid(FieldName.REMOTE_SERVER_DN, true);

--
Gitblit v1.10.0