From 7202af24c668dba3f56c85a178bbe57c69d15691 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 09 Sep 2009 17:57:29 +0000
Subject: [PATCH] Fix for issue 4224 (The error messages connecting to server are not consistent)

---
 opends/src/guitools/org/opends/guitools/controlpanel/ui/LocalOrRemotePanel.java |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ui/LocalOrRemotePanel.java b/opends/src/guitools/org/opends/guitools/controlpanel/ui/LocalOrRemotePanel.java
index b75f70c..e15deba 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ui/LocalOrRemotePanel.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ui/LocalOrRemotePanel.java
@@ -56,6 +56,7 @@
 import javax.swing.JTextField;
 import javax.swing.SwingUtilities;
 
+import org.opends.admin.ads.ServerDescriptor;
 import org.opends.admin.ads.util.ApplicationTrustManager;
 import org.opends.admin.ads.util.ConnectionUtils;
 import org.opends.guitools.controlpanel.datamodel.ConfigReadException;
@@ -556,17 +557,18 @@
                 }
                 else
                 {
-                  errors.add(ERR_CANNOT_CONNECT_TO_LOGIN_WITHOUT_CAUSE.get());
+                  errors.add(Utils.getMessageForException(
+                      (NamingException)throwable));
                 }
                 localServerErrorConnecting = true;
               }
               else
               {
-                String msg = throwable.toString();
-                errors.add(ERR_CANNOT_CONNECT_TO_REMOTE.get(
+                String hostPort = ServerDescriptor.getServerRepresentation(
                     hostName.getText().trim(),
-                    port.getText().trim(),
-                    msg));
+                    new Integer(port.getText().trim()));
+                NamingException ne = (NamingException)throwable;
+                errors.add(Utils.getMessageForException(ne, hostPort));
                 setPrimaryInvalid(portLabel);
               }
               setPrimaryInvalid(dnLabel);

--
Gitblit v1.10.0