| | |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.controls; |
| | | import org.opends.messages.Message; |
| | | |
| | | |
| | | |
| | |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | import static org.opends.server.messages.MessageHandler.*; |
| | | import static org.opends.server.messages.ProtocolMessages.*; |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | |
| | | if (controlValue == null) |
| | | { |
| | | // The response control must always have a value. |
| | | int msgID = MSGID_PWPOLICYRES_NO_CONTROL_VALUE; |
| | | String message = getMessage(msgID); |
| | | throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, msgID, message); |
| | | Message message = ERR_PWPOLICYRES_NO_CONTROL_VALUE.get(); |
| | | throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, message); |
| | | } |
| | | |
| | | |
| | |
| | | PasswordPolicyWarningType.valueOf(integerElement.getType()); |
| | | if (warningType == null) |
| | | { |
| | | int msgID = MSGID_PWPOLICYRES_INVALID_WARNING_TYPE; |
| | | String message = getMessage(msgID, |
| | | byteToHex(integerElement.getType())); |
| | | throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, msgID, |
| | | message); |
| | | Message message = ERR_PWPOLICYRES_INVALID_WARNING_TYPE.get( |
| | | byteToHex(integerElement.getType())); |
| | | throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, message); |
| | | } |
| | | break; |
| | | |
| | |
| | | errorType = PasswordPolicyErrorType.valueOf(errorValue); |
| | | if (errorType == null) |
| | | { |
| | | int msgID = MSGID_PWPOLICYRES_INVALID_ERROR_TYPE; |
| | | String message = getMessage(msgID, errorValue); |
| | | throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, msgID, |
| | | message); |
| | | Message message = |
| | | ERR_PWPOLICYRES_INVALID_ERROR_TYPE.get(errorValue); |
| | | throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, message); |
| | | } |
| | | break; |
| | | |
| | | default: |
| | | int msgID = MSGID_PWPOLICYRES_INVALID_ELEMENT_TYPE; |
| | | String message = getMessage(msgID, byteToHex(e.getType())); |
| | | throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, msgID, |
| | | message); |
| | | Message message = ERR_PWPOLICYRES_INVALID_ELEMENT_TYPE.get( |
| | | byteToHex(e.getType())); |
| | | throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, message); |
| | | } |
| | | } |
| | | |
| | |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, ae); |
| | | } |
| | | |
| | | int msgID = MSGID_PWPOLICYRES_DECODE_ERROR; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, msgID, message); |
| | | Message message = ERR_PWPOLICYRES_DECODE_ERROR.get(ae.getMessage()); |
| | | throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, message); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_PWPOLICYRES_DECODE_ERROR; |
| | | String message = getMessage(msgID, getExceptionMessage(e)); |
| | | throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, msgID, message); |
| | | Message message = |
| | | ERR_PWPOLICYRES_DECODE_ERROR.get(getExceptionMessage(e)); |
| | | throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, message); |
| | | } |
| | | } |
| | | |