directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Zeller <tzel...@memphis.edu>
Subject 1.5.5 convertAttributesFromLdif : An entry must not have two DNs
Date Tue, 12 May 2009 13:44:37 GMT
In trunk, it looks like LdifUtils.convertAttributesFromLdif() throws a
NamingException for ldif containing a dn.

The following

String ldif =
     "dn: ou=foo,dc=example,dc=edu\n" +
     "ou: foo\n" +
     "objectclass: top\n" +
     "objectclass: organizationalUnit\n";

 LdifUtils.convertAttributesFromLdif(ldif);

throws a NamingException

 LdifAttributesReader.parseAttribute(175) - An entry must not have two DNs
 LdifAttributesReader.parseAttributes(294) - Cannot parse the ldif
buffer : A ldif entry should not have two DNs

It looks like the appropriate test in LdifUtilsTest.java, was commented out

    /**
     * Test a conversion of an entry from a LDIF file
     */
    @Test
    public void testConvertToLdif() throws NamingException
    {
        String expected =
            "dn:: Y249U2Fhcm\n" +
            " Jyw7xja2VuLCBk\n" +
            " Yz1leGFtcGxlLC\n" +
            " BkYz1jb20=\n" +
            "changeType: Add\n" +
            "sn: test\n" +
            "cn:: U2FhcmJyw7\n xja2Vu\n" +
            "objectClass: to\n p\n" +
            "objectClass: pe\n rson\n" +
            "objectClass: in\n etorgPerson\n\n";

        LdifEntry entry = new LdifEntry();
        entry.setDn( "cn=Saarbr\u00FCcken, dc=example, dc=com" );
        entry.setChangeType( ChangeType.Add );

        EntryAttribute oc = new DefaultClientAttribute( "objectClass" );
        oc.add( "top", "person", "inetorgPerson" );

        entry.addAttribute( oc );

        entry.addAttribute( "cn", "Saarbr\u00FCcken" );
        entry.addAttribute( "sn", "test" );

        String ldif = LdifUtils.convertToLdif( entry, 15 );
        //Attributes result = LdifUtils.convertFromLdif( ldif );
        //assertEquals( entry, result );
    }

I tried adding "version: 1\n" to the beginning of the ldif to no avail.

Perhaps http://issues.apache.org/jira/browse/DIRSHARED-22 introduced
this behavior.

Thanks,
Tom

Mime
View raw message