Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

easybatch-flatfile bug reading file #177

Closed
arnauldSerge opened this issue Feb 26, 2016 · 9 comments
Closed

easybatch-flatfile bug reading file #177

arnauldSerge opened this issue Feb 26, 2016 · 9 comments

Comments

@arnauldSerge
Copy link

Hello,

i try to read csv file(with 5000 lines).
i use flatfile reader.
i get a correct total number but he did'nt process any line .
in Engine.caller the hasnext() method get false even we are on the firt line.
however, when i use a file with only 300 lines i didn't get this bug.

Thank for this useful framework.

I use the 3.0.0 version

@fmbenhassine
Copy link
Member

Hi,

i get a correct total number but he did'nt process any line .

Have you registered any record processor?

in Engine.caller the hasnext() method get false even we are on the firt line.
however, when i use a file with only 300 lines i didn't get this bug.

Can you please give me your code to be able to reproduce the issue?
What is your OS? line separator may play a role..
What is the encoding of your file? Which Java version are your using?

Don't worry for the input file, I'll generate a dummy one with 5k lines.

Kind regards
Mahmoud

@fmbenhassine
Copy link
Member

Hi,

Any update on this issue?
It would be helpful to share a code snippet to let me reproduce the bug.

Thank you in advance
Kind regards
Mahmoud

@arnauldSerge
Copy link
Author

Hi,
thank for your attention on my issue,
il still looking for the issu. so you can find my code below

            final EngineBuilder builder = new EngineBuilder().reader(flatFileRecordReader)//
                                                             .mapper(delimiter)//
                                                             .validator(validatorHandler)//
                                                             .processor(new ReferentielProcessor(parameters))//
                                                             .errorRecordHandler(errorHandler)
                                                             .recordProcessorEventListener(new TransactionUnitProcessingEventListener(parameters))//
                                                             .batchProcessEventListener(new TransactionBlockProcessingEventListener(parameters, validatorHandler,errorHandler))
                                                             .ignoredRecordHandler(ignoreRecordHandler)
                                                             .strictMode(false);

            if (parameters.getIgnoreFirstLine()) {
                builder.filter(new HeaderRecordFilter());
            }

            builder.filter(new StartWithStringRecordFilter("#"));
            Engine engine = builder.build();
            report = engine.call();

@arnauldSerge
Copy link
Author

In the Engine.call() methode at this
report.setTotalRecords(totalRecords);

i have a rigth total

but when at while (recordReader.hasNextRecord()) , i did'nt have any entry, it like it was at the end of the file

@arnauldSerge
Copy link
Author

Hi,
i realized that the issue occurs when i use a Charset to create my flatFile, so i removed the charset.

flatFileRecordReader= new FlatFileRecordReader(loadfile,charset.name());

but i think i need a workaround to fix this.

I found also an issue with Scanner it seem that they have a bug with Buffer_SIZE,
the scanner did'nt find all line in the file and stop in the middle of the last line he found.

Thank you so mutch for time you spend to help me

@fmbenhassine
Copy link
Member

Hi,

any update on this issue?

Have you tried to use the latest version 4.0.0 ? Please let me know it is the case.

Kind regards
Mahmoud

@fmbenhassine
Copy link
Member

Hi,

I really want to help on this. Do you need support to migrate your code to v4 line?

Kind regards
Mahmoud

@arnauldSerge
Copy link
Author

arnauldSerge commented Jun 13, 2016

Hello, i'm sorry, i have forgotten my password, so i found solution for my problem,
i realized that according to the file encoding the framework interpret them as end of file.
So to avoid this i translate the content of my file in an ArrayList then i used ListRecordReader.

I didn't use the version 4.0.0 but i will try it in the next version of my program.

regards

@fmbenhassine
Copy link
Member

Hello, no problem, glad you found a solution.

If you need support, I'm eager to help!

Kind regards
Mahmoud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants