[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Problem with LDIFReader always requiring version number in LDIF file

Another question I have is related to the LDIFWriter. Just like the
LDIFReader, the LDIFWriter always writes a "version: 1" line out to
the output file. How do I prevent it from writing this out to the file


On 5/10/05, Safdar Kureishy <safdar.kureishy@gmail.com> wrote:
> Hi,
> I couldn't find anything about this on the newsgroup, so am posting
> this message.
> I am running into a problem where the LDIFReader (from JLDAP) requires
> a "version" field to exist in the LDIF file that it is made to read.
> When it doesn't find the version field, the LDIFReader throws the
> following exception:
> LDAPLocalException: com.novell.ldap.ldif_dsml.LDIFReader: Version line
> must be the first meaningful line(on line 1 of the file) (82) Local
> Error
> I will always be getting LDIF files from the customer that don't have
> a version number as the first line. Instead of adding this line on the
> top of each file (which could be an expensive operation for large
> LDIFs) before parsing them, is there any way that I can make the
> LDIFReader not complain about the version and just default to version
> 1? If I add "version: 1" to the file, it works fine, so I know that
> defaulting to version 1 should be fine.
> I've looked around but couldn't find any way of working around this
> error in a simple way. Any help would be greatly appreciated.
> Thanks,
> Safdar