}
try
{
Set<String> maskedAttributes = getMaskedAttributes();
LdifChangeAddRecord record = new LdifChangeAddRecord( LdifDnLine.create( dn ) );
addControlLines( record, controls );
record.setChangeType( LdifChangeTypeLine.createAdd() );
NamingEnumeration<? extends Attribute> attributeEnumeration = attributes.getAll();
while ( attributeEnumeration.hasMore() )
{
Attribute attribute = attributeEnumeration.next();
String attributeName = attribute.getID();
NamingEnumeration<?> valueEnumeration = attribute.getAll();
while ( valueEnumeration.hasMore() )
{
Object o = valueEnumeration.next();
if ( maskedAttributes.contains( Strings.toLowerCase( attributeName ) ) )
{
record.addAttrVal( LdifAttrValLine.create( attributeName, "**********" ) ); //$NON-NLS-1$
}
else
{
if ( o instanceof String )
{
record.addAttrVal( LdifAttrValLine.create( attributeName, ( String ) o ) );
}
if ( o instanceof byte[] )
{
record.addAttrVal( LdifAttrValLine.create( attributeName, ( byte[] ) o ) );
}
}
}
}
record.finish( LdifSepLine.create() );
String formattedString = record.toFormattedString( LdifFormatParameters.DEFAULT );
log( formattedString, ex, connection );
}
catch ( NamingException e )
{
}