From 4ba6839c824d98decba9030a90b4b6ca8b5846a8 Mon Sep 17 00:00:00 2001
From: Violette Roche-Montane <violette.roche-montane@forgerock.com>
Date: Wed, 27 Feb 2013 08:37:32 +0000
Subject: [PATCH] OPENDJ-771 rebuild-index tool should fail when "--clearDegradedState" and "--rebuildAll" options are specified on the same command line

---
 opendj-sdk/opends/src/messages/messages/tools.properties               |    4 ++--
 opendj-sdk/opends/src/server/org/opends/server/tools/RebuildIndex.java |   12 +++++++++++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/opendj-sdk/opends/src/messages/messages/tools.properties b/opendj-sdk/opends/src/messages/messages/tools.properties
index 7e40eef..1b97b2d 100644
--- a/opendj-sdk/opends/src/messages/messages/tools.properties
+++ b/opendj-sdk/opends/src/messages/messages/tools.properties
@@ -2591,8 +2591,8 @@
  with the "-i" option or the "--rebuildAll" option
 SEVERE_ERR_REBUILDINDEX_REBUILD_DEGRADED_ERROR_1721=Index "-i" option cannot be \
  specified with the "--rebuildDegraded" option
-SEVERE_ERR_REBUILDINDEX_REBUILD_ALL_DEGRADED_ERROR_1722=Option "--rebuildAll" \
- cannot be specified with the "--rebuildDegraded" option
+SEVERE_ERR_REBUILDINDEX_REBUILD_ALL_DEGRADED_ERROR_1722=Option "--%s" \
+ cannot be specified with the "--%s" option
 SEVERE_ERR_CONFIGDS_CANNOT_UPDATE_DIGEST_MD5_FQDN_1733=An error occurred while \
  attempting to update the FQDN for the DIGEST-MD5 SASL mechanism:  %s
 INFO_REBUILDINDEX_DESCRIPTION_CLEAR_DEGRADED_STATE_1734=Indicates that indexes do not need \
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/RebuildIndex.java b/opendj-sdk/opends/src/server/org/opends/server/tools/RebuildIndex.java
index 83a6305..cfc38b5 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/RebuildIndex.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/RebuildIndex.java
@@ -294,7 +294,17 @@
 
     if(rebuildAll.isPresent() && rebuildDegraded.isPresent())
     {
-      Message msg = ERR_REBUILDINDEX_REBUILD_ALL_DEGRADED_ERROR.get();
+      Message msg = ERR_REBUILDINDEX_REBUILD_ALL_DEGRADED_ERROR.get("rebuildAll",
+          "rebuildDegraded");
+      err.println(wrapText(msg, MAX_LINE_WIDTH));
+      out.println(argParser.getUsage());
+      return 1;
+    }
+
+    if(rebuildAll.isPresent() && clearDegradedState.isPresent())
+    {
+      Message msg = ERR_REBUILDINDEX_REBUILD_ALL_DEGRADED_ERROR.get("rebuildAll",
+          "clearDegradedState");
       err.println(wrapText(msg, MAX_LINE_WIDTH));
       out.println(argParser.getUsage());
       return 1;

--
Gitblit v1.10.0