From 27ea664735339eb6127bfb575a587af24cd317fe Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 25 Mar 2009 10:32:39 +0000
Subject: [PATCH] Fix for issue 3297 (English answer hardcoded in tools.properties) Use localized strings to check the answer provided by the user. Be more permisive and make a non-case sensitive check of the user's answer (so know Yes is accepted).
---
opendj-sdk/opends/src/server/org/opends/server/tools/PromptTrustManager.java | 10 ++++++++--
opendj-sdk/opends/src/messages/messages/tools.properties | 12 ++++++++++--
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/opendj-sdk/opends/src/messages/messages/tools.properties b/opendj-sdk/opends/src/messages/messages/tools.properties
index d0d3105..a420be9 100644
--- a/opendj-sdk/opends/src/messages/messages/tools.properties
+++ b/opendj-sdk/opends/src/messages/messages/tools.properties
@@ -407,8 +407,8 @@
I?' response from the Directory Server: %s
MILD_ERR_LDAPAUTH_WHOAMI_FAILED_204=The 'Who Am I?' request was rejected by \
the Directory Server
-SEVERE_ERR_SEARCH_INVALID_SEARCH_SCOPE_205=Invalid scope %s specified for the \
- search request
+SEVERE_ERR_SEARCH_INVALID_SEARCH_SCOPE_205=Invalid scope '%s' specified for \
+ the search request
SEVERE_ERR_SEARCH_NO_FILTERS_206=No filters specified for the search request
INFO_VERIFYINDEX_DESCRIPTION_BASE_DN_207=Base DN of a backend \
supporting indexing. Verification is performed on indexes within the scope of \
@@ -2452,5 +2452,13 @@
the instance directory %s.\nInstance directory is referenced by %s
INFO_LDIFEXPORT_PATH_TO_LDIF_FILE_1662=Exporting to %s
+#
+# These are the localized version of the answers that the user can provide in
+# interactive tools.
+#
+INFO_PROMPT_YES_COMPLETE_ANSWER_1663=yes
+INFO_PROMPT_YES_FIRST_LETTER_ANSWER_1664=y
+INFO_PROMPT_NO_COMPLETE_ANSWER_1665=no
+INFO_PROMPT_NO_FIRST_LETTER_ANSWER_1666=n
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/PromptTrustManager.java b/opendj-sdk/opends/src/server/org/opends/server/tools/PromptTrustManager.java
index e58dc8d..014c7e8 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/PromptTrustManager.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/PromptTrustManager.java
@@ -163,13 +163,19 @@
{
System.out.print(prompt);
String line = reader.readLine().toLowerCase();
- if (line.equals("y") || line.equals("yes"))
+ if (line.equalsIgnoreCase(
+ INFO_PROMPT_YES_COMPLETE_ANSWER.get().toString()) ||
+ line.equalsIgnoreCase(
+ INFO_PROMPT_YES_FIRST_LETTER_ANSWER.get().toString()))
{
// Returning without an exception is sufficient to consider the
// certificate trusted.
return;
}
- else if (line.equals("n") || line.equals("no"))
+ if (line.equalsIgnoreCase(
+ INFO_PROMPT_NO_COMPLETE_ANSWER.get().toString()) ||
+ line.equalsIgnoreCase(
+ INFO_PROMPT_NO_FIRST_LETTER_ANSWER.get().toString()))
{
Message message = ERR_PROMPTTM_USER_REJECTED.get();
throw new CertificateException(message.toString());
--
Gitblit v1.10.0