Skip to content

Incorrect usage of StringBuilder in TransactionAwareBufferedWriter #3745

Closed
@pstowski

Description

@pstowski

Method public void write(String str, int off, int len) of org.springframework.batch.support.transaction.TransactionAwareBufferedWriter
seems to be using java.lang.StringBuilder in wrong way:
according to documentation StringBuilder.append(java.lang.CharSequence,int,int)
third parameter is not length (as in append(char[],int,int)) but the end index of the subsequence.
this causes invalid parts of string are being appended and causes java.lang.IndexOutOfBoundsException when off > len

Using: spring-batch-infrastructure 4.2.4.RELEASE

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions