nkuprins opened a new pull request, #957: URL: https://github.com/apache/fesod/pull/957
## Purpose of the pull request Closed: #956 ## What's changed? `WriteCellStyle.merge` copied the source's `DataFormatData` into the target **by reference**. Because the annotation-driven style source is parsed once and cached, a later merge from another style source (e.g. a registered `HorizontalCellStyleStrategy`) wrote into that shared object and permanently changed the cached `@ContentStyle(dataFormat)` - producing the wrong number format on rows where the strategy defines no format, and (with `CacheLocationEnum.MEMORY`) on later, unrelated writes of the same bean class. The fix clones the `DataFormatData` before assigning it, exactly like `writeFont` is already cloned a few lines below in the same method: ```diff - target.setDataFormatData(source.getDataFormatData()); + target.setDataFormatData(source.getDataFormatData().clone()); ``` Added `ContentStyleDataFormatPollutionTest` with two regression tests that assert on the number format of the **written file** (via the testkit's `ExcelAssertions`): - `annotationFormatSurvivesStyleStrategyInSameWrite` - default config: a row whose strategy style has no data format must keep the annotation's `#,##0.00`. - `annotationFormatSurvivesAcrossWritesWithMemoryCache` - `MEMORY` cache location: a follow-up write with no custom handlers must keep the annotation's format. Both tests fail on `main` (format comes out `0.00`) and pass with the fix. The full `fesod-sheet` suite passes with the fix applied (673 tests, 0 failures, 0 errors, 0 skipped), confirming no behavior change for styles that don't involve a shared `DataFormatData`. ## Checklist - [x] I have read the [Contributor Guide](https://fesod.apache.org/community/contribution/). - [x] I have written the necessary doc or comment. - [x] I have added the necessary unit tests and all cases have passed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
