if ( tlv.getLength() == 0 )
{
String msg = I18n.err( I18n.ERR_04085 );
LOG.error( msg );
AddResponseImpl response = new AddResponseImpl( addRequest.getMessageId() );
// I guess that trying to add an entry which Dn is empty is a naming violation...
// Not 100% sure though ...
throw new ResponseCarryingException( msg, response, ResultCodeEnum.NAMING_VIOLATION,
Dn.EMPTY_DN, null );
}
else
{
Dn entryDn = null;
byte[] dnBytes = tlv.getValue().getData();
String dnStr = Strings.utf8ToString( dnBytes );
try
{
entryDn = new Dn( dnStr );
}
catch ( LdapInvalidDnException ine )
{
String msg = "Invalid Dn given : " + dnStr + " (" + Strings.dumpBytes( dnBytes )
+ ") is invalid";
LOG.error( "{} : {}", msg, ine.getMessage() );
AddResponseImpl response = new AddResponseImpl( addRequest.getMessageId() );
throw new ResponseCarryingException( msg, response, ResultCodeEnum.INVALID_DN_SYNTAX,
Dn.EMPTY_DN, ine );
}
addRequest.setEntryDn( entryDn );