{
if ( !valueExpected )
{
if ( !( ava instanceof String ) )
{
throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, I18n.err(
I18n.ERR_12085, ( pos + 1 ) ) );
}
String attribute = ( String ) ava;
sb.append( attribute );
if ( attribute.indexOf( ':' ) != -1 )
{
sb.append( '\n' );
}
else
{
valueExpected = true;
}
}
else
{
if ( ava instanceof String )
{
sb.append( ": " ).append( ( String ) ava ).append( '\n' );
}
else if ( ava instanceof byte[] )
{
sb.append( ":: " );
sb.append( new String( Base64.encode( ( byte[] ) ava ) ) );
sb.append( '\n' );
}
else
{
throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, I18n.err(
I18n.ERR_12086, ( pos + 1 ) ) );
}
valueExpected = false;
}
}
if ( valueExpected )
{
throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, I18n
.err( I18n.ERR_12087 ) );
}
// Now, parse the Ldif and convert it to a LdifEntry
LdifReader reader = new LdifReader();