public void action( LdapMessageContainer<DeleteRequestDecorator> container ) throws DecoderException
{
// Create the DeleteRequest LdapMessage instance and store it in the container
DeleteRequest internaldelRequest = new DeleteRequestImpl();
internaldelRequest.setMessageId( container.getMessageId() );
DeleteRequestDecorator delRequest = new DeleteRequestDecorator(
container.getLdapCodecService(), internaldelRequest );
container.setMessage( delRequest );
// And store the Dn into it
// Get the Value and store it in the DelRequest
TLV tlv = container.getCurrentTLV();
// We have to handle the special case of a 0 length matched
// Dn
Dn entry = null;
if ( tlv.getLength() == 0 )
{
// This will generate a PROTOCOL_ERROR
throw new DecoderException( I18n.err( I18n.ERR_04073 ) );
}
else
{
byte[] dnBytes = tlv.getValue().getData();
String dnStr = Strings.utf8ToString( dnBytes );
try
{
entry = new Dn( dnStr );
}
catch ( LdapInvalidDnException ine )
{
String msg = I18n.err( I18n.ERR_04074, dnStr, Strings.dumpBytes( dnBytes ), ine
.getLocalizedMessage() );
LOG.error( msg );
DeleteResponseImpl response = new DeleteResponseImpl( delRequest.getMessageId() );
throw new ResponseCarryingException( msg, response, ResultCodeEnum.INVALID_DN_SYNTAX,
Dn.EMPTY_DN, ine );
}
delRequest.setName( entry );
}
// We can have an END transition
container.setGrammarEndAllowed( true );