From 7008381ae6c2eb1fd67a1cc50b8e78dbc2fc78c6 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 20 Jul 2007 17:11:56 +0000
Subject: [PATCH] Fix for issue 2006.

---
 opends/src/server/org/opends/server/tools/ConfigureDS.java |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/opends/src/server/org/opends/server/tools/ConfigureDS.java b/opends/src/server/org/opends/server/tools/ConfigureDS.java
index 9b2bc52..756fc29 100644
--- a/opends/src/server/org/opends/server/tools/ConfigureDS.java
+++ b/opends/src/server/org/opends/server/tools/ConfigureDS.java
@@ -28,7 +28,9 @@
 
 
 
+import java.util.HashSet;
 import java.util.LinkedList;
+import java.util.Set;
 
 import org.opends.server.api.ConfigHandler;
 import org.opends.server.config.BooleanConfigAttribute;
@@ -329,6 +331,54 @@
       return 1;
     }
 
+    try
+    {
+      Set<Integer> ports = new HashSet<Integer>();
+      if (ldapPort.isPresent())
+      {
+        ports.add(ldapPort.getIntValue());
+      }
+      if (ldapsPort.isPresent())
+      {
+        if (ports.contains(ldapsPort.getIntValue()))
+        {
+          int    msgID   = MSGID_CONFIGDS_PORT_ALREADY_SPECIFIED;
+          String message = getMessage(msgID,
+              String.valueOf(ldapsPort.getIntValue()));
+          System.err.println(wrapText(message, MAX_LINE_WIDTH));
+          System.err.println(argParser.getUsage());
+          return 1;
+        }
+        else
+        {
+          ports.add(ldapsPort.getIntValue());
+        }
+      }
+      if (jmxPort.isPresent())
+      {
+        if (ports.contains(jmxPort.getIntValue()))
+        {
+          int    msgID   = MSGID_CONFIGDS_PORT_ALREADY_SPECIFIED;
+          String message = getMessage(msgID,
+              String.valueOf(jmxPort.getIntValue()));
+          System.err.println(wrapText(message, MAX_LINE_WIDTH));
+          System.err.println(argParser.getUsage());
+          return 1;
+        }
+        else
+        {
+          ports.add(jmxPort.getIntValue());
+        }
+      }
+    }
+    catch (ArgumentException ae)
+    {
+      int    msgID   = MSGID_CANNOT_INITIALIZE_ARGS;
+      String message = getMessage(msgID, ae.getMessage());
+      System.err.println(wrapText(message, MAX_LINE_WIDTH));
+      return 1;
+    }
+
 
     // Initialize the Directory Server configuration handler using the
     // information that was provided.

--
Gitblit v1.10.0