Skip to content

fix(format): each thread formats numbers with a formatter of its own - #204

Merged
stbischof merged 1 commit into
eclipse-daanse:mainfrom
stbischof:fix/format-per-thread
Dec 1, 2026
Merged

stbischof merged 1 commit into
eclipse-daanse:mainfrom
stbischof:fix/format-per-thread

Conversation

@stbischof

Copy link
Copy Markdown
Contributor

A format is cached and handed to every caller that asks for the same format string, and a java.text.NumberFormat keeps the digits of the value it is working on in fields of its own. Two threads formatting through one shared format read each other's digits: grouping and decimal marks land in the wrong place, a cell shows another cell's number, or the string comes out as NUL characters. The locale is what the format shares; the formatter is per thread. AFormatIsSharedBetweenThreadsTest formats from many threads through one format.

A format is cached and handed to every caller that asks for the same format string, and a java.text.NumberFormat
keeps the digits of the value it is working on in fields of its own. Two threads formatting through one shared
format read each other's digits: grouping and decimal marks land in the wrong place, a cell shows another cell's
number, or the string comes out as NUL characters. The locale is what the format shares; the formatter is per
thread.

Signed-off-by: Stefan Bischof <stbischof@bipolis.org>
@stbischof
stbischof merged commit 00460a8 into eclipse-daanse:main Dec 1, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant