0

Does anyone have problem with using LdifReader. The code that i using is this:

LdifReader reader = new LdifReader();
List entries = reader.parseLdifFile("/tmp/file.ldif");
for (LdifEntry entry : entries) {
System.out.println(entry.get("cn"));
}

The problem is that every time that i execute code give me different result and sometimes are not displayed all entries. With different result i mean if ldif file have this data: Entry 1: ... Entry2: ... .... Entry n: ... Entry n+1: ... If i execute will give some output entry1, entry2. ... entryN, next run on some code will produce output with same entries, but in different order and so on. The main problem is that even if i remove this:

for (LdifEntry entry : entries) {
System.out.println(entry.get("cn")); }

There will be output with all data from particular entries(not all) , and i don’t know where is the problem. If in “for” i put something like this

System.out.println(“testing”);

this will not be printed in most of the runs. Any help is welcomed.

  • It isn't plausible that you get different results executing the same code on the same file. It sounds like you aren't running the code that you think you're running. – user207421 Oct 01 '13 at 01:47
  • i try to execute only this code in whole main method, the file is same. If you have can you post example code how to read ldif file and from every entry let set print only one attribute(ex. mail) – user1260255 Oct 01 '13 at 08:40
  • 1
    What exception handling are you using that is not shown in your snippet? – Terry Gardner Oct 02 '13 at 18:37
  • I'm handling LdapLdifException but error is not given when program is executed. Anyway i solve my problem with using ldap query which solve my activity more faster than LdifReader :) – user1260255 Oct 03 '13 at 20:41

0 Answers0