From cfc513043c5830b5a967733066068c7097b42e3c Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Wed, 15 Aug 2007 21:34:53 +0000
Subject: [PATCH] This commit is a step toward getting OpenDS internationalized. There are still issues to be resolved before we can declare that we are internationalized but this commit covers the bulk of changes needed at this time.
---
opendj-sdk/opends/src/server/org/opends/server/extensions/LengthBasedPasswordValidator.java | 28 +++++++++++++---------------
1 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/LengthBasedPasswordValidator.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/LengthBasedPasswordValidator.java
index 568e198..d95e0f3 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/LengthBasedPasswordValidator.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/LengthBasedPasswordValidator.java
@@ -25,6 +25,7 @@
* Portions Copyright 2006-2007 Sun Microsystems, Inc.
*/
package org.opends.server.extensions;
+import org.opends.messages.Message;
@@ -43,9 +44,8 @@
import org.opends.server.types.Operation;
import org.opends.server.types.ResultCode;
-import static org.opends.server.messages.ExtensionsMessages.*;
-import static org.opends.server.messages.MessageHandler.*;
-
+import static org.opends.messages.ExtensionMessages.*;
+import org.opends.messages.MessageBuilder;
/**
@@ -92,9 +92,9 @@
int minLength = configuration.getMinimumPasswordLength();
if ((maxLength > 0) && (minLength > 0) && (minLength > maxLength))
{
- int msgID = MSGID_PWLENGTHVALIDATOR_MIN_GREATER_THAN_MAX;
- String message = getMessage(msgID, minLength, maxLength);
- throw new ConfigException(msgID, message);
+ Message message =
+ ERR_PWLENGTHVALIDATOR_MIN_GREATER_THAN_MAX.get(minLength, maxLength);
+ throw new ConfigException(message);
}
}
@@ -118,7 +118,7 @@
public boolean passwordIsAcceptable(ByteString newPassword,
Set<ByteString> currentPasswords,
Operation operation, Entry userEntry,
- StringBuilder invalidReason)
+ MessageBuilder invalidReason)
{
LengthBasedPasswordValidatorCfg config = currentConfig;
@@ -127,16 +127,14 @@
int minLength = config.getMinimumPasswordLength();
if ((minLength > 0) && (numChars < minLength))
{
- invalidReason.append(getMessage(MSGID_PWLENGTHVALIDATOR_TOO_SHORT,
- minLength));
+ invalidReason.append(ERR_PWLENGTHVALIDATOR_TOO_SHORT.get(minLength));
return false;
}
int maxLength = config.getMaximumPasswordLength();
if ((maxLength > 0) && (numChars > maxLength))
{
- invalidReason.append(getMessage(MSGID_PWLENGTHVALIDATOR_TOO_LONG,
- minLength));
+ invalidReason.append(ERR_PWLENGTHVALIDATOR_TOO_LONG.get(minLength));
return false;
}
@@ -150,7 +148,7 @@
*/
@Override()
public boolean isConfigurationAcceptable(PasswordValidatorCfg configuration,
- List<String> unacceptableReasons)
+ List<Message> unacceptableReasons)
{
LengthBasedPasswordValidatorCfg config =
(LengthBasedPasswordValidatorCfg) configuration;
@@ -164,7 +162,7 @@
*/
public boolean isConfigurationChangeAcceptable(
LengthBasedPasswordValidatorCfg configuration,
- List<String> unacceptableReasons)
+ List<Message> unacceptableReasons)
{
// Make sure that if both the maximum and minimum lengths are set, the
// maximum length is greater than or equal to the minimum length.
@@ -172,8 +170,8 @@
int minLength = configuration.getMinimumPasswordLength();
if ((maxLength > 0) && (minLength > 0) && (minLength > maxLength))
{
- int msgID = MSGID_PWLENGTHVALIDATOR_MIN_GREATER_THAN_MAX;
- String message = getMessage(msgID, minLength, maxLength);
+ Message message = ERR_PWLENGTHVALIDATOR_MIN_GREATER_THAN_MAX.get(
+ minLength, maxLength);
unacceptableReasons.add(message);
return false;
}
--
Gitblit v1.10.0