Set<ByteString> currentPasswords,
Operation operation, Entry userEntry,
MessageBuilder invalidReason)
{
// Get a handle to the current configuration.
CharacterSetPasswordValidatorCfg config = currentConfig;
HashMap<String,Integer> characterSets = this.characterSets;
// Process the provided password.
String password = newPassword.toString();
HashMap<String,Integer> counts = new HashMap<String,Integer>();
for (int i=0; i < password.length(); i++)
{
char c = password.charAt(i);
boolean found = false;
for (String characterSet : characterSets.keySet())
{
if (characterSet.indexOf(c) >= 0)
{
Integer count = counts.get(characterSet);
if (count == null)
{
counts.put(characterSet, 1);
}
else
{
counts.put(characterSet, count+1);
}
found = true;
break;
}
}
if ((! found) && (! config.isAllowUnclassifiedCharacters()))
{
invalidReason.append(ERR_CHARSET_VALIDATOR_ILLEGAL_CHARACTER.get(
String.valueOf(c)));
return false;
}