| | |
| | | * Portions Copyright 2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.controls; |
| | | import org.opends.messages.Message; |
| | | |
| | | |
| | | |
| | |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.LDAPException; |
| | | |
| | | 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.*; |
| | | |
| | |
| | | ASN1OctetString controlValue = control.getValue(); |
| | | if (controlValue == null) |
| | | { |
| | | int msgID = MSGID_VLVREQ_CONTROL_NO_VALUE; |
| | | String message = getMessage(msgID); |
| | | throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, msgID, message); |
| | | Message message = INFO_VLVREQ_CONTROL_NO_VALUE.get(); |
| | | throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, message); |
| | | } |
| | | |
| | | try |
| | |
| | | |
| | | if ((elements.size() < 3) || (elements.size() > 4)) |
| | | { |
| | | int msgID = MSGID_VLVREQ_CONTROL_INVALID_ELEMENT_COUNT; |
| | | String message = getMessage(msgID, elements.size()); |
| | | throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, msgID, message); |
| | | Message message = |
| | | INFO_VLVREQ_CONTROL_INVALID_ELEMENT_COUNT.get(elements.size()); |
| | | throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, message); |
| | | } |
| | | |
| | | int beforeCount = elements.get(0).decodeAsInteger().intValue(); |
| | |
| | | break; |
| | | |
| | | default: |
| | | int msgID = MSGID_VLVREQ_CONTROL_INVALID_TARGET_TYPE; |
| | | String message = getMessage(msgID, byteToHex(targetType)); |
| | | throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, msgID, |
| | | message); |
| | | Message message = INFO_VLVREQ_CONTROL_INVALID_TARGET_TYPE.get( |
| | | byteToHex(targetType)); |
| | | throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, message); |
| | | } |
| | | |
| | | ASN1OctetString contextID = null; |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_VLVREQ_CONTROL_CANNOT_DECODE_VALUE; |
| | | String message = getMessage(msgID, getExceptionMessage(e)); |
| | | throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, msgID, message, e); |
| | | Message message = |
| | | INFO_VLVREQ_CONTROL_CANNOT_DECODE_VALUE.get(getExceptionMessage(e)); |
| | | throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, message, e); |
| | | } |
| | | } |
| | | |