From 1b54e562f26b33a6a5e490dff93bb5c4ce446f69 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Sat, 17 Oct 2009 01:07:40 +0000
Subject: [PATCH] Fix for issue 4295 (Issues with dsreplication interactive mode)

---
 opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java |   26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java b/opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java
index c1e59aa..4c132f6 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java
@@ -1067,7 +1067,9 @@
     String bindDn2 = null;
     String pwd2 = null;
     ci.resetHeadingDisplayed();
-    ci.resetTrustManager();
+
+    boolean doNotDisplayFirstError = false;
+
     if (!cancelled)
     {
       host2 = argParser.getHostName2();
@@ -1087,6 +1089,7 @@
       }
       else if (bindDn2 == null)
       {
+        doNotDisplayFirstError = true;
         pwd = adminPwd;
         if (argParser.getSecureArgsList().bindPasswordFileArg.isPresent())
         {
@@ -1156,10 +1159,19 @@
       catch (ClientException ce)
       {
         LOG.log(Level.WARNING, "Client exception "+ce);
-        println();
-        println(ce.getMessageObject());
-        println();
-        ci.resetConnectionArguments();
+        if (!doNotDisplayFirstError)
+        {
+          println();
+          println(ce.getMessageObject());
+          println();
+          ci.resetConnectionArguments();
+        }
+        else
+        {
+          // Reset only the credential parameters.
+          ci.resetConnectionArguments();
+          ci.initializeGlobalArguments(host2, port2, null, null, null, null);
+        }
       }
       catch (ArgumentException ae)
       {
@@ -1169,6 +1181,10 @@
         println();
         cancelled = true;
       }
+      finally
+      {
+        doNotDisplayFirstError = false;
+      }
     }
 
     if (!cancelled)

--
Gitblit v1.10.0