userEntry = matchingEntries.get(0);
}
// Get the password policy state for the user entry.
PasswordPolicyState pwpState;
PasswordPolicy policy;
try
{
pwpState = new PasswordPolicyState(userEntry, false);
policy = pwpState.getPolicy();
}
catch (DirectoryException de)
{
if (debugEnabled())
{
TRACER.debugCaught(DebugLogLevel.ERROR, de);
}
operation.setResponseData(de);
return;
}
// Create a hash set that will be used to hold the types of the return
// types that should be included in the response.
boolean returnAll;
LinkedHashSet<Integer> returnTypes = new LinkedHashSet<Integer>();
try
{
if (!reader.hasNextElement())
{
// There is no operations sequence.
returnAll = true;
}
else if(reader.peekLength() <= 0)
{
// There is an operations sequence but its empty.
returnAll = true;
reader.readStartSequence();
reader.readEndSequence();
}
else
{
returnAll = false;
reader.readStartSequence();
while(reader.hasNextElement())
{
int opType;
ArrayList<String> opValues;
reader.readStartSequence();
opType = (int)reader.readInteger();
if (!reader.hasNextElement())
{
// There is no values sequence
opValues = null;
}
else if(reader.peekLength() <= 0)
{
// There is a values sequence but its empty
opValues = null;
reader.readStartSequence();
reader.readEndSequence();
}
else
{
reader.readStartSequence();
opValues = new ArrayList<String>();
while (reader.hasNextElement())
{
opValues.add(reader.readOctetStringAsString());
}
reader.readEndSequence();
}
reader.readEndSequence();
if(!processOp(opType, opValues, operation,
returnTypes, pwpState, policy))
{
return;
}
}
reader.readEndSequence();
}
reader.readEndSequence();
// If there are any modifications that need to be made to the password
// policy state, then apply them now.
List<Modification> stateMods = pwpState.getModifications();
if ((stateMods != null) && (! stateMods.isEmpty()))
{
ModifyOperation modifyOperation =
conn.processModify(targetDN, stateMods);
if (modifyOperation.getResultCode() != ResultCode.SUCCESS)