fix: fall back to default format index on malformed style index (#355) - #1059
Open
Mikkey-f wants to merge 1 commit into
Open
fix: fall back to default format index on malformed style index (#355)#1059Mikkey-f wants to merge 1 commit into
Mikkey-f wants to merge 1 commit into
Conversation
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.
Fixes #355
What changes were proposed in this pull request?
CellTagHandlerparses a cell'ssattribute (style index) with a bareInteger.parseInt. A non-numeric value — as produced by some third-party tools — threwNumberFormatExceptionand aborted the whole file read at the first corrupt cell (in the report: reading stopped at row 3218 of 3000+ rows).The parse now falls back to the default format index (
0) onNumberFormatException: a corrupt style index only loses that cell's style info, while the cell value and all subsequent rows are still read. This follows the reporter's suggestion and matches POI's lenient behavior (POI reads the same file completely, with the corrupt cell read as empty).How was this patch tested?
CellTagHandlerTest(2 new unit tests): non-numericsfalls back todataFormatData(0)without throwing; numericskeeps the exact lookup.CorruptStyleIndexReadTest(new end-to-end test): a minimal hand-built xlsx whose middle row carriess="abc"is read completely — all 3 rows returned.NumberFormatException: For input string: "abc"); with the fix it passes.fesod-sheetsuite: 915/915 green.spotless:checkandjavadocpass.Notes