iryndin / jdbf

Java utility to read/write DBF files
108 stars 77 forks source link

Exception in thread "main" java.io.IOException: Resetting to invalid mark - on getMemoAsString() #22

Open Xachman opened 8 years ago

Xachman commented 8 years ago

I dont know for sure what version of FoxPro my client is running but its old and the type meta data gives me a value of FoxPro2x.

I got this error when using getMemoAsString(); it would show the first entry then fail on the second entry. After some debugging and googling I realized that BufferedInputStream would throw this error if the skip() value was greater then the buffer size. BUFFER_SIZE in the MemoReader is set at 8192 and memoHeader.getBlockSize()*offsetInBlocks was giving me huge numbers like 18510208. Now I didnt do well in school but 18510208 is greater then 8192. So, I set the BUFFER_SIZE to 185102080 and it went threw with no errors.

Now This is probably not the best solution to the problem but I wanted to mention it. Maybe there should be a set method for the buffer size.

Xachman commented 8 years ago

Im working on fix to this in my fork here https://github.com/Xachman/jdbf

iryndin commented 8 years ago

Can you please send me FoxPro file which causes this fail? To: iryndin At gmail dot com. I have some time to work on this issue now.

Xachman commented 8 years ago

Hi files are sent. I wanted to mention my current solution to this in the fork is to open and close the input stream in the MemoReader class in the read function. this seems to have solved the problem for me and the data is accurate, as far as I can tell, with the foxpro application I have running. Im building an importer to couchdb with this right now

For now the only way I was able to make this possible is to limit the arguments you can pass in to file objects.

Xachman commented 6 years ago

No but I did fork the project you can try that fork out and see if my fix works for you.


From: Cristina Sarasua notifications@github.com Sent: Friday, November 17, 2017 6:42 AM To: iryndin/jdbf Cc: Xachman; Author Subject: Re: [iryndin/jdbf] Exception in thread "main" java.io.IOException: Resetting to invalid mark - on getMemoAsString() (#22)

hello, I also get this error. Is this issue solved?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/iryndin/jdbf/issues/22#issuecomment-345222132, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHV1blf6TaWmrm-mF6yv9vnOH_7J_TQKks5s3XEQgaJpZM4HXPlu.