albfernandez / javadbf

Java library for reading and writing Xbase (dBase/DBF) files.
GNU Lesser General Public License v3.0
224 stars 98 forks source link

error when parsing leading space characters #92

Closed Nicole-6246 closed 10 months ago

Nicole-6246 commented 3 years ago

If the field contains space character at the begining, the "field.getLength()" counts the length contains length of non-space, then the "dataInputStream.read" only cut the first length, so return the spaces but cut off characters at the end.

below is where it happened: protected Object getFieldValue(DBFField field) throws IOException { int bytesReaded = 0; switch (field.getType()) { case CHARACTER: byte b_array[] = new byte[field.getLength()]; bytesReaded = this.dataInputStream.read(b_array);

albfernandez commented 3 years ago

Hi I've released a new version. It's the bug yet happening in the latest version? if yes, can you provide some sample file / code to reproduce de bug?

Thanks