{
try
{
SearchResult sr = enumeration.next();
LdapDN dn = JNDIUtils.getDn( sr );
LdifContentRecord record = LdifContentRecord.create( dn.getUpName() );
NamingEnumeration<? extends Attribute> attributeEnumeration = sr.getAttributes().getAll();
while ( attributeEnumeration.hasMore() )
{
Attribute attribute = attributeEnumeration.next();
String attributeName = attribute.getID();
NamingEnumeration<?> valueEnumeration = attribute.getAll();
while ( valueEnumeration.hasMore() )
{
Object o = valueEnumeration.next();
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() );
return record;
}
catch ( NamingException e )