fix: make DataFormatter cache configuration-aware - #1068
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The implementation addresses the reported stale-cache behavior with focused regression coverage and no unresolved issues.
Pull request overview
Makes the thread-local DataFormatter cache configuration-aware, preventing stale formatting settings across sequential operations.
Changes:
- Recreates cached formatters when locale, date windowing, or scientific formatting changes.
- Adds regression tests for configuration changes, cache reuse, and locale isolation.
File summaries
| File | Description |
|---|---|
NumberDataFormatterUtils.java |
Stores and compares the formatter’s effective configuration. |
NumberDataFormatterUtilsTest.java |
Tests cache replacement and locale-safe parallel execution. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| this.locale = locale; | ||
| this.useScientificFormat = useScientificFormat; | ||
| this.dataFormatter = new DataFormatter(use1904windowing, locale, useScientificFormat); | ||
| } |
There was a problem hiding this comment.
@delei I would recommend setting this on your DataFormatter.
There was a problem hiding this comment.
Thanks, @pjfanning. Fesod uses its own formatter and already reads cached formula results. While checking this, I found that XLS formula errors are always returned as #VALUE!, regardless of the cached error. I'll follow up with a separate fix.
Purpose of the pull request
Closed: #1065
NumberDataFormatterUtilscurrently reuses the firstDataFormattercreated on a thread even when a later operation requests a different locale, date windowing mode, or scientific-format setting. This makes formatting order-dependent and can produce output in the wrong locale.What's changed?
DataFormattertogether with its effective constructor configuration.use1904windowing,locale, anduseScientificFormatall match; otherwise replace it.Verification:
fesod-sheettest suite with the JVM default locale set to Korean: 897 tests passed.parallel-testsprofile: 100 tests passed.Checklist