From 74b6e3013b463a413ccf687216465b6f9aac17c4 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Mon, 26 Nov 2007 09:30:59 +0000
Subject: [PATCH] Fix for issue 2010.
---
opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/ArgumentExceptionFactory.java | 28 +++++++---------------------
opendj-sdk/opends/src/messages/messages/dsconfig.properties | 6 ++++--
opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/SubCommandHandler.java | 6 +++---
opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/HelpSubCommandHandler.java | 8 ++++----
4 files changed, 18 insertions(+), 30 deletions(-)
diff --git a/opendj-sdk/opends/src/messages/messages/dsconfig.properties b/opendj-sdk/opends/src/messages/messages/dsconfig.properties
index 53aed11..8d94090 100644
--- a/opendj-sdk/opends/src/messages/messages/dsconfig.properties
+++ b/opendj-sdk/opends/src/messages/messages/dsconfig.properties
@@ -167,8 +167,8 @@
following syntax: property:value
SEVERE_ERR_DSCFG_ERROR_SUB_TYPE_UNRECOGNIZED_1066=The sub-type "%s" is not a \
recognized type of %s. It should be one of: %s
-SEVERE_ERR_DSCFG_ERROR_TYPE_UNRECOGNIZED_1067="%s" is not a recognized \
- component type
+SEVERE_ERR_DSCFG_ERROR_TYPE_UNRECOGNIZED_FOR_CATEGORY_1067="%s" component \
+ type that cannot be used with category "%s"
SEVERE_ERR_DSCFG_ERROR_NO_SEPARATOR_IN_PROPERTY_MOD_1068=The property \
modification "%s" does not contain a name/value separator. The argument \
should have the following syntax: property[+|-]:value
@@ -415,6 +415,8 @@
INFO_DSCFG_PROMPT_SECURITY_PROTOCOL_DEFAULT_CHOICE_1391=%d
SEVERE_ERR_DSCFG_PROMPT_SECURITY_INVALID_FILE_PATH_1392=The provided path is not valid
INFO_DSCFG_PROMPT_EDIT_AGAIN_1393=Would you like to edit the properties of the %s again in order to resolve this problem?
+SEVERE_ERR_DSCFG_ERROR_TYPE_UNRECOGNIZED_FOR_SUBCOMMAND_1394="%s" component \
+ type cannot be used with subcommand {%s}
INFO_EDITOR_PROMPT_SELECT_COMPONENT_MULTI_127=Select one or more %s for the "%s" property:
INFO_EDITOR_PROMPT_SELECT_COMPONENT_SINGLE_128=Select a %s for the "%s" property:
INFO_EDITOR_HEADING_COMPONENT_SUMMARY_129=The "%s" property references the following %s:
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 5ed4b82..c19e755 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
@@ -584,22 +584,6 @@
}
-
- /**
- * Creates an argument exception which should be used when a managed
- * object type argument is not recognized.
- *
- * @param typeName
- * The unrecognized component type.
- * @return Returns an argument exception.
- */
- public static ArgumentException unknownType(String typeName) {
- Message msg = ERR_DSCFG_ERROR_TYPE_UNRECOGNIZED.get(typeName);
- return new ArgumentException(msg);
- }
-
-
-
/**
* Creates an argument exception which should be used when a managed
* object type argument is not associated with a category.
@@ -610,8 +594,8 @@
* The unrecognized component type.
* @return Returns an argument exception.
*/
- public static ArgumentException unknownTypeInCategory(String categoryName,
- String typeName) {
+ public static ArgumentException unknownTypeForCategory(String typeName,
+ String categoryName) {
Message msg =
ERR_DSCFG_ERROR_CATEGORY_TYPE_UNRECOGNIZED.get(typeName, categoryName);
return new ArgumentException(msg);
@@ -628,12 +612,14 @@
* The relation definition.
* @param d
* The definition of the managed object that was retrieved.
+ *
+ * @param subcommandName the sub-command name.
* @return Returns a CLI exception.
*/
public static CLIException wrongManagedObjectType(RelationDefinition<?, ?> r,
- ManagedObjectDefinition<?, ?> d) {
- Message msg = ERR_DSCFG_ERROR_TYPE_UNRECOGNIZED
- .get(d.getUserFriendlyName());
+ ManagedObjectDefinition<?, ?> d, String subcommandName) {
+ Message msg = ERR_DSCFG_ERROR_TYPE_UNRECOGNIZED_FOR_SUBCOMMAND.get(
+ d.getUserFriendlyName(), subcommandName);
return new CLIException(msg);
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/HelpSubCommandHandler.java b/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/HelpSubCommandHandler.java
index c265be2..2333668 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/HelpSubCommandHandler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/HelpSubCommandHandler.java
@@ -825,7 +825,6 @@
throw ArgumentExceptionFactory.unknownCategory(categoryName);
}
- categoryName = null;
subTypes = tagMap.get(tag);
if (subTypes == null) {
throw ArgumentExceptionFactory.unknownCategory(categoryName);
@@ -838,8 +837,8 @@
if (typeName != null) {
AbstractManagedObjectDefinition<?, ?> d = subTypes.get(typeName);
if (d == null) {
- throw ArgumentExceptionFactory.unknownTypeInCategory(categoryName,
- typeName);
+ throw ArgumentExceptionFactory.unknownTypeForCategory(typeName,
+ categoryName);
}
dlist.add(d);
@@ -863,7 +862,8 @@
}
if (!isFound) {
- throw ArgumentExceptionFactory.unknownType(typeName);
+ throw ArgumentExceptionFactory.unknownTypeForCategory(typeName,
+ categoryName);
}
} else {
// User did not specify a category nor a sub-type.
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/SubCommandHandler.java b/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/SubCommandHandler.java
index 28e558d..a749766 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/SubCommandHandler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/SubCommandHandler.java
@@ -175,7 +175,7 @@
// definition.
if (!child.getManagedObjectDefinition().isChildOf(d)) {
clie = ArgumentExceptionFactory.wrongManagedObjectType(r, child
- .getManagedObjectDefinition());
+ .getManagedObjectDefinition(), getSubCommand().getName());
result = MenuResult.quit();
} else {
result = MenuResult.<ManagedObject<?>>success(child);
@@ -219,7 +219,7 @@
// definition.
if (!child.getManagedObjectDefinition().isChildOf(d)) {
clie = ArgumentExceptionFactory.wrongManagedObjectType(r, child
- .getManagedObjectDefinition());
+ .getManagedObjectDefinition(), getSubCommand().getName());
result = MenuResult.quit();
} else {
result = MenuResult.<ManagedObject<?>>success(child);
@@ -263,7 +263,7 @@
// definition.
if (!child.getManagedObjectDefinition().isChildOf(d)) {
clie = ArgumentExceptionFactory.wrongManagedObjectType(r, child
- .getManagedObjectDefinition());
+ .getManagedObjectDefinition(), getSubCommand().getName());
result = MenuResult.quit();
} else {
result = MenuResult.<ManagedObject<?>>success(child);
--
Gitblit v1.10.0