Skip to content

SimpleBinaryBufferedReaderFactory misses line endings #811

Closed
@spring-projects-issues

Description

@spring-projects-issues
Collaborator

cosban opened BATCH-2792 and commented

If a line contains the first character of the line delimiter within N characters of the actual beginning of the line ending delimiter, where N is the length of the line ending delimiter, then the SimpleBinaryBufferedReaderFactory will incorrectly miss the actual line ending and continue reading.

The '#' character is within 5 characters of the actual line ending for this example. This causes the candidateEnding to contain #3#@# before determining that it is not the correct line ending, appending all of these characters to the line buffer, and continuing.
I suspect it would be better for the method to fail fast the moment that current candidate doesn't match the provided template. i.e. once #3 is determined to not be a possible match of the template going forward.

I have provided a full example of a situation which causes this to fail below:

EXAMPLE OF BUG: lineEnding = `#@#@#`, lines = `Value_1,Value_2,Value#3#@#@#Value_4,Value_5,Value_6`

BAD OUTPUT: `Value_1` `Value_2` `Value#3#@#@#Value_4` `Value_5` `Value_6`

CORRECT OUTPUT: `Value_1` `Value_2` `Value#3`
                `Value_4` `Value_5` `Value_6`

No further details from BATCH-2792

Activity

added this to the 5.2.0-M1 milestone on Apr 23, 2024
added 2 commits that reference this issue on Apr 23, 2024
cc56744
929a551
changed the title [-]SimpleBinaryBufferedReaderFactory misses line endings [BATCH-2792][/-] [+]SimpleBinaryBufferedReaderFactory misses line endings[/+] on Apr 23, 2024
added a commit that references this issue on Apr 24, 2024
2e9d96b
added a commit that references this issue on Feb 2, 2025
8578bb9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Participants

      @fmbenhassine@spring-projects-issues

      Issue actions

        SimpleBinaryBufferedReaderFactory misses line endings · Issue #811 · spring-projects/spring-batch