directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lecharny <elecha...@apache.org>
Subject Re: 1.5.5 convertAttributesFromLdif : An entry must not have two DNs
Date Tue, 12 May 2009 14:23:58 GMT
Tom Zeller wrote:
> In trunk, it looks like LdifUtils.convertAttributesFromLdif() throws a
> NamingException for ldif containing a dn.
>   
Plain normal, but might be confusing. What happens is that this method 
tries to convert something stored using a LDIF format to an Attributes 
(JNDI). Attributes objects don't contain a DN, only attributes.

This method is a bit confusing, as it does not state that it does not 
try to convert only the attributes.

If you want to parse a LDIF to get an Attributes object, you have to use 
the LdifReader.parseLdif( String ), you'll get a List of Entry objects, 
and loop on the entry's attributes to convert them to Attribute, and 
store them into an Attributes.

FYI, we have defined a new set of classes to manage LDAP elements, based 
on the Entry element (basically, an entry is a DN plus a set of attributes).

Hope it helps.

-- 
--
cordialement, regards,
Emmanuel L├ęcharny
www.iktek.com
directory.apache.org



Mime
View raw message