[
https://issues.apache.org/jira/browse/DIRAPI-242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14613008#comment-14613008
]
Emmanuel Lecharny commented on DIRAPI-242:
------------------------------------------
I have written a test with the LDIF you provided, and it passes like a charm :
{code}
@Test
public void testLdifParser1() throws Exception, Exception
{
String ldif =
"version: 1\n" +
"\n" +
"dn: OU=SAP,DC=sap,DC=local\n" +
"objectClass: organizationalUnit\n" +
"objectClass: top\n" +
"instanceType: 4\n" +
"objectCategory:
CN=Organizational-Unit,CN=Schema,CN=Configuration,DC=sap,DC=\n" +
" local\n" +
"ou: SAP\n" +
"distinguishedName: OU=SAP,DC=sap,DC=local\n" +
"dSCorePropagationData: 20150608094628.0Z\n" +
"dSCorePropagationData: 16010101000001.0Z\n" +
"name: SAP\n" +
"objectGUID:: WFlektZ2C0aFHTEbgTscfw==\n" +
"uSNChanged: 12761\n" +
"uSNCreated: 12760\n" +
"whenChanged: 20150608094628.0Z\n" +
"whenCreated: 20150608094627.0Z\n";
LdifReader reader = new LdifReader();
List<LdifEntry> entries = reader.parseLdif( ldif );
LdifEntry entry = entries.get( 0 );
System.out.println( entry );
reader.close();
}
{code}
Result :
{code}
dn: OU=SAP,DC=sap,DC=local
usncreated: 12760
dscorepropagationdata: 20150608094628.0Z
dscorepropagationdata: 16010101000001.0Z
distinguishedname: OU=SAP,DC=sap,DC=local
ou: SAP
usnchanged: 12761
whencreated: 20150608094627.0Z
name: SAP
objectcategory: CN=Organizational-Unit,CN=Schema,CN=Configuration,DC=sap,DC=loca
l
whenchanged: 20150608094628.0Z
objectguid:: WFlektZ2C0aFHTEbgTscfw==
objectclass: organizationalUnit
objectclass: top
instancetype: 4
{code}
Can you attach the LDIF file you are trying to read ? (there must be some
garbled chars that are not shown in your report).
Thanks !
> LDIF Reader
> -----------
>
> Key: DIRAPI-242
> URL: https://issues.apache.org/jira/browse/DIRAPI-242
> Project: Directory Client API
> Issue Type: Bug
> Affects Versions: 1.0.0-M30
> Reporter: Steven Nguyen
> Attachments: SAP.ldif
>
>
> Hi Team,
> I want to parse an LDIF file using LdifReader. My LDIF content is simple but
> when I call the parse() method, it throws out below exception
> org.apache.directory.api.ldap.model.ldif.LdapLdifException: ERR_12070 Error
> while parsing the ldif buffer
> at
> org.apache.directory.api.ldap.model.ldif.LdifReader.parseLdif(LdifReader.java:1847)
> at com.advantco.ldap.test.LDIFParser.main(LDIFParser.java:19)
> Caused by: org.apache.directory.api.ldap.model.ldif.LdapLdifException:
> ERR_12013_NO_DN No DN for entry
> at
> org.apache.directory.api.ldap.model.ldif.LdifReader.parseDn(LdifReader.java:628)
> at
> org.apache.directory.api.ldap.model.ldif.LdifReader.parseEntry(LdifReader.java:1413)
> at
> org.apache.directory.api.ldap.model.ldif.LdifReader.parseLdif(LdifReader.java:2050)
> at
> org.apache.directory.api.ldap.model.ldif.LdifReader.parseLdif(LdifReader.java:1834)
> ... 1 more
> Below please find my sample LDIF content:
> version: 1
> dn: OU=SAP,DC=sap,DC=local
> objectClass: organizationalUnit
> objectClass: top
> instanceType: 4
> objectCategory: CN=Organizational-Unit,CN=Schema,CN=Configuration,DC=sap,DC=
> local
> ou: SAP
> distinguishedName: OU=SAP,DC=sap,DC=local
> dSCorePropagationData: 20150608094628.0Z
> dSCorePropagationData: 16010101000001.0Z
> name: SAP
> objectGUID:: WFlektZ2C0aFHTEbgTscfw==
> uSNChanged: 12761
> uSNCreated: 12760
> whenChanged: 20150608094628.0Z
> whenCreated: 20150608094627.0Z
> The LDIF content is exported using Apache Directory Studio. The server is MS
> Active Directory.
> Hope my question is clear enough.
> Best Regards,
> Steven Nguyen
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)