fix: keep the coordinates in a cloned ReadCellData - #1132
Open
CodeMan-cmd wants to merge 1 commit into
Open
CodeMan-cmd wants to merge 1 commit into
CodeMan-cmd wants to merge 1 commit into
Conversation
A cell read into a ReadCellData field, or read with READ_CELL_DATA, went through ReadCellData.clone(), which copied the value and the format but not rowIndex and columnIndex. The parsers do set them (CellTagHandler, FormulaRecordHandler, BoolErrRecordHandler, CsvExcelReadExecutor), so the coordinates were available in the very call that clones the cell, and every ReadCellData handed to a listener came back with null coordinates. The clone now keeps them, which also matches WriteCellData, where the coordinates are set on the way out.
2 tasks
skytin1004
approved these changes
Sep 24, 2026
skytin1004
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the fix. I reproduced the missing coordinates with the pre-fix implementation and verified that this change preserves the row and column indexes for XLSX, XLS, and CSV. All tests passed locally with Java 11. LGTM.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose of the pull request
Closed: #1131
What's changed?
A cell read as
ReadCellData(a model field typedReadCellData/CellData, orreadDefaultReturn(READ_CELL_DATA)) is produced byConverterUtils.convertToJavaObject, which clones the parsed cell.ReadCellData.clone()copied the type, the value, the data format and the formula but notrowIndex/columnIndex, so everyReadCellDatahanded to a listener had null coordinates even though the parsers set them andconvertToJavaObjectalready receives both indexes as arguments. The clone now keeps them, which also matchesWriteCellData, where the coordinates are set on the way out.Measured before the change, same test, on all three formats:
date(row=null,col=null) integer1(row=null,col=null) formula(row=null,col=null); after the change:date(row=1,col=0) integer1(row=1,col=1) formula(row=1,col=3).Tests:
CellDataDataTestasserts the coordinates of theReadCellDatafields of a round trip, for xlsx, xls and csv.ReadCellDataTest.cloneKeepsCoordinatesis a unit test for the clone itself.Without the fix 4 of the 5 new assertions fail, with the fix all of them pass.
Local verification with Temurin 1.8.0_472:
./mvnw clean package -B -Dmaven.test.skip=false -pl fesod-common,fesod-shaded,fesod-sheet-> 917 tests, 0 failures./mvnw spotless:check-> Build successChecklist