spring-projects / spring-projects/spring-batch

TransactionAwareBufferedWriter adds byte order mark on each chunk [BATCH-1985]

Open
#1,608 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: infrastructure status: waiting-for-reporter type: bug
Dominant language
Java
Stars
3k
Forks
2.5k
Avg merge
6d 53m
Merged PRs (30d)
3

Description

Jimmy Praet opened BATCH-1985 and commented

When using a TransactionAwareBufferedWriter (FlatFileItemWriter or StaxEventItemWriter) with an encoding that requires a byte order mark (e.g. UTF-16), the byte order mark (BOM) is emitted on each chunk. On each chunk string.getBytes(encoding) is called on the string buffer, which will return a BOM as the first few bytes of the byte array.

The BOM should only be written at the very beginning of the output stream. If a BOM appears anywhere else, it is interpreted as a 'ZERO-WIDTH NON-BREAKING SPACE'.

http://docs.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html#standard
https://forums.oracle.com/forums/thread.jspa?threadID=2042544
http://www.unicode.org/faq/utf_bom.html


No further details from BATCH-1985

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading TransactionAwareBufferedWriter and its use by FlatFileItemWriter and StaxEventItemWriter, then reproduce the behavior with UTF-16 output written in multiple chunks. Done means the byte order mark appears only at the beginning of the output stream and not on later chunks.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.