From f949a1b1a43ddf651009021f3e935e41b12b8c4f Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Thu, 27 Aug 2009 15:38:26 +0000
Subject: [PATCH] Fix for issue 4195 (dsreplication enable should check that the user did not provide the same host:port twice) The fix also applies to dsreplication initialize.
---
opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java | 26 ++++++++++++++++++++++----
opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java | 4 ++--
2 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java b/opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java
index 72f2982..8541de6 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java
@@ -1913,7 +1913,7 @@
if (hostName1Arg.getValue().equalsIgnoreCase(hostName2Arg.getValue()) &&
!isInteractive())
{
- if (port1Arg.getValue() == port2Arg.getValue())
+ if (port1Arg.getValue().equals(port2Arg.getValue()))
{
Message message = ERR_REPLICATION_ENABLE_SAME_SERVER_PORT.get(
hostName1Arg.getValue(), port1Arg.getValue());
@@ -2033,7 +2033,7 @@
if (hostNameSourceArg.getValue().equalsIgnoreCase(
hostNameDestinationArg.getValue()) && !isInteractive())
{
- if (portSourceArg.getValue() == portDestinationArg.getValue())
+ if (portSourceArg.getValue().equals(portDestinationArg.getValue()))
{
Message message = ERR_REPLICATION_INITIALIZE_SAME_SERVER_PORT.get(
hostNameSourceArg.getValue(), portSourceArg.getValue());
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 7dedabc..d3ddd58 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
@@ -2267,11 +2267,29 @@
hostDestination = ci.getHostName();
portDestination = ci.getPortNumber();
- ctxDestination = createInitialLdapContextInteracting(ci);
-
- if (ctxDestination == null)
+ boolean error = false;
+ if (hostSource.equalsIgnoreCase(hostDestination))
{
- cancelled = true;
+ if (portSource == portDestination)
+ {
+ portDestination = -1;
+ Message message = ERR_REPLICATION_INITIALIZE_SAME_SERVER_PORT.get(
+ hostSource, String.valueOf(portSource));
+ println();
+ println(message);
+ println();
+ error = true;
+ }
+ }
+
+ if (!error)
+ {
+ ctxDestination = createInitialLdapContextInteracting(ci);
+
+ if (ctxDestination == null)
+ {
+ cancelled = true;
+ }
}
}
catch (ClientException ce)
--
Gitblit v1.10.0