From bb7922caed39fdea1c518515adeb12ad6c9be66f Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Mon, 31 May 2010 09:11:54 +0000
Subject: [PATCH] Fix issue #4560. Added special case for the --reset keyword.
---
opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/ArgumentExceptionFactory.java | 22 +++++++++++++++++++++-
opendj-sdk/opends/src/messages/messages/dsconfig.properties | 6 +++++-
opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/SetPropSubCommandHandler.java | 7 +++++++
3 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/opendj-sdk/opends/src/messages/messages/dsconfig.properties b/opendj-sdk/opends/src/messages/messages/dsconfig.properties
index 1217897..edaeace 100644
--- a/opendj-sdk/opends/src/messages/messages/dsconfig.properties
+++ b/opendj-sdk/opends/src/messages/messages/dsconfig.properties
@@ -20,7 +20,7 @@
#
# CDDL HEADER END
#
-# Copyright 2006-2009 Sun Microsystems, Inc.
+# Copyright 2006-2010 Sun Microsystems, Inc.
@@ -228,6 +228,10 @@
SEVERE_ERR_DSCFG_ERROR_UNABLE_TO_RESET_MANDATORY_PROPERTY_1200=The %s \
property "%s" is mandatory cannot be reset. Use the "%s" option to specify a \
new value
+SEVERE_ERR_DSCFG_ERROR_UNABLE_TO_RESET_PROPERTY_WITH_VALUE_1201="--%s %s" : \
+ the argument "--%s" \
+ reset the property to the default value. It cannot be used to set a property \
+ to a given value
SEVERE_ERR_DSCFG_ERROR_ILLEGAL_NAME_SYNTAX_1204=The name "%s" is not a valid \
name for the %s which has the following syntax: %s
SEVERE_ERR_DSCFG_ERROR_ILLEGAL_NAME_EMPTY_1205=Empty names are not permitted \
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/ArgumentExceptionFactory.java b/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/ArgumentExceptionFactory.java
index e649e07..aed84ad 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/ArgumentExceptionFactory.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/ArgumentExceptionFactory.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2008 Sun Microsystems, Inc.
+ * Copyright 2008-2010 Sun Microsystems, Inc.
*/
package org.opends.server.tools.dsconfig;
@@ -497,6 +497,26 @@
/**
* Creates an argument exception which should be used when an
+ * attempt is made to reset a property with a value.
+ *
+ * @param name
+ * The name of the mandatory property.
+ * @param resetOption
+ * The name of the option which should be used to reset the
+ * property's values.
+ * @return Returns an argument exception.
+ */
+ public static ArgumentException unableToResetPropertyWithValue(String name,
+ String resetOption) {
+ Message message = ERR_DSCFG_ERROR_UNABLE_TO_RESET_PROPERTY_WITH_VALUE.get(
+ resetOption, name, resetOption);
+ return new ArgumentException(message);
+ }
+
+
+
+ /**
+ * Creates an argument exception which should be used when an
* attempt is made to set the naming property for a managed object
* during creation.
*
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/SetPropSubCommandHandler.java b/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/SetPropSubCommandHandler.java
index e990cb5..888b219 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/SetPropSubCommandHandler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/SetPropSubCommandHandler.java
@@ -765,6 +765,13 @@
// Reset properties.
for (String m : propertyResetArgument.getValues()) {
+
+ // Check one does not try to reset with a value
+ if (m.contains(":")) {
+ throw ArgumentExceptionFactory.unableToResetPropertyWithValue(m,
+ OPTION_DSCFG_LONG_RESET);
+ }
+
// Check the property definition.
PropertyDefinition<?> pd;
try {
--
Gitblit v1.10.0