/**
* {@inheritDoc}
*/
public void action( LdapMessageContainer<CompareRequestDecorator> container ) throws DecoderException
{
CompareRequest compareRequest = container.getMessage();
// Get the Value and store it in the CompareRequest
TLV tlv = container.getCurrentTLV();
Dn entry = null;
// We have to handle the special case of a 0 length matched
// Dn
if ( tlv.getLength() == 0 )
{
// This will generate a PROTOCOL_ERROR
throw new DecoderException( I18n.err( I18n.ERR_04089 ) );
}
else
{
byte[] dnBytes = tlv.getValue().getData();
String dnStr = Strings.utf8ToString( dnBytes );
try
{
entry = new Dn( dnStr );
}
catch ( LdapInvalidDnException ine )
{
String msg = "Invalid Dn given : " + dnStr + " (" + Strings.dumpBytes( dnBytes )
+ ") is invalid";
LOG.error( "{} : {}", msg, ine.getMessage() );
CompareResponseImpl response = new CompareResponseImpl( compareRequest.getMessageId() );
throw new ResponseCarryingException( msg, response, ResultCodeEnum.INVALID_DN_SYNTAX,
Dn.EMPTY_DN, ine );
}
compareRequest.setName( entry );
}
if ( IS_DEBUG )
{
LOG.debug( "Comparing Dn {}", entry );