From 79456ab528b185983884c14443e0fe64425874da Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 07 Jul 2016 13:03:32 +0000
Subject: [PATCH] Partial OPENDJ-2625 Convert all code that uses JNDI to use the SDK instead

---
 opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/Installer.java |   49 +++++++++++++++++++++++--------------------------
 1 files changed, 23 insertions(+), 26 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/Installer.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/Installer.java
index 1d8449c..a9a119c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/Installer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/Installer.java
@@ -1947,10 +1947,10 @@
             backendTypes.get(backendName).getBackend());
       }
     }
-    catch (NamingException ne)
+    catch (NamingException e)
     {
-      LocalizableMessage failedMsg = getThrowableMsg(INFO_ERROR_CONNECTING_TO_LOCAL.get(), ne);
-      throw new ApplicationException(ReturnCode.CONFIGURATION_ERROR, failedMsg, ne);
+      LocalizableMessage failedMsg = getThrowableMsg(INFO_ERROR_CONNECTING_TO_LOCAL.get(), e);
+      throw new ApplicationException(ReturnCode.CONFIGURATION_ERROR, failedMsg, e);
     }
   }
 
@@ -2487,18 +2487,10 @@
           }
         }
       }
-      catch (NamingException ne)
+      catch (IOException e)
       {
-        LocalizableMessage msg;
-        if (isCertificateException(ne))
-        {
-          msg = INFO_ERROR_READING_CONFIG_LDAP_CERTIFICATE_SERVER.get(getHostPort(server), ne.toString(true));
-        }
-        else
-        {
-          msg = INFO_CANNOT_CONNECT_TO_REMOTE_GENERIC.get(getHostPort(server), ne.toString(true));
-        }
-        throw new ApplicationException(ReturnCode.CONFIGURATION_ERROR, msg, ne);
+        LocalizableMessage msg = Utils.getMessageForException(e);
+        throw new ApplicationException(ReturnCode.CONFIGURATION_ERROR, msg, e);
       }
     }
 
@@ -2551,18 +2543,10 @@
               }
             }
           }
-          catch (NamingException ne)
+          catch (IOException e)
           {
-            LocalizableMessage msg;
-            if (isCertificateException(ne))
-            {
-              msg = INFO_ERROR_READING_CONFIG_LDAP_CERTIFICATE_SERVER.get(getHostPort(server), ne.toString(true));
-            }
-            else
-            {
-              msg = INFO_CANNOT_CONNECT_TO_REMOTE_GENERIC.get(getHostPort(server), ne.toString(true));
-            }
-            throw new ApplicationException(ReturnCode.CONFIGURATION_ERROR, msg, ne);
+            LocalizableMessage msg = Utils.getMessageForException(e);
+            throw new ApplicationException(ReturnCode.CONFIGURATION_ERROR, msg, e);
           }
         }
         if (replicationId == -1)
@@ -2741,6 +2725,19 @@
         }
       }
     }
+    catch (IOException e)
+    {
+      LocalizableMessage msg;
+      if (isRemoteServer)
+      {
+        msg = getMessageForException(e, auth.getHostPort().toString());
+      }
+      else
+      {
+        msg = Utils.getMessageForException(e);
+      }
+      throw new ApplicationException(ReturnCode.CONFIGURATION_ERROR, msg, e);
+    }
     catch (NamingException ne)
     {
       LocalizableMessage msg;
@@ -3955,7 +3952,7 @@
    * Update the UserInstallData object with the contents of the server to which
    * we are connected with the provided connection.
    */
-  private void updateUserDataWithSuffixesInServer(ConnectionWrapper conn) throws NamingException
+  private void updateUserDataWithSuffixesInServer(ConnectionWrapper conn) throws IOException
   {
     SuffixesToReplicateOptions suf = getUserData().getSuffixesToReplicateOptions();
     SuffixesToReplicateOptions.Type type;

--
Gitblit v1.10.0