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
Incorrect usage of StringBuilder in TransactionAwareBufferedWriter #3745
Comments
We ran into that bug too, via |
Same problem, using |
I would like to start contributing to this project. This seems like a good issue to work on. Can someone provide steps how to reproduce the problem? |
@nfjcore You are welcome! Please check our Contributor Guidelines. I did not work on this issue yet to validate the bug report, but the best way to start is by trying to create a failing test that reproduces the problem. I would be happy to review any PR that contains such a test with a corresponding fix. Let me know if you want me to assign this issue to you. |
@benas Thank you for the reply. I've read the Contributor Guidelines. And like the issue to be assigned to me. |
@niels5789 I don't have a simple testcase for this right now but you should be able to reproduce this by generating XML output using |
In order to avoid any confusion about to whom this issue should be assigned, I'm not going to assign it to anyone. Everyone is welcome to contribute to the project. If a PR is opened for this bug, I will link it to this issue. |
Fixed in #3843 . |
Method
public void write(String str, int off, int len)
oforg.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
whenoff > len
Using: spring-batch-infrastructure 4.2.4.RELEASE
The text was updated successfully, but these errors were encountered: