Repository navigation
fix(serialization): fix quote stripping bounds in TextParseNode and add tests - #2223
Merged
Vincent Biret (baywet) merged 4 commits intoOct 27, 2026
Conversation
Contributor
Author
|
This PR addresses an index calculation issue and edge cases in
All tests pass ( |
…tParseNode Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
…onWriter Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
Hardik K (hardikkaurani)
force-pushed
the
fix/text-parsenode-quoted-strings
branch
from
October 27, 2026 13:45
252562b to
90ff242
Compare
Contributor
Author
|
I have updated the branch to address the SpotBugs \OS_OPEN_STREAM\ failure reported in :components:serialization:text:spotbugsTest. Specifically, the stream reading helper in \TextSerializationWriterTest\ now uses try-with-resources to ensure both the underlying \InputStream\ and readers are safely closed on all execution paths. Local verification:
All 4 commits are clean and signed-off. Ready for review when you have a moment. |
Vincent Biret (baywet)
approved these changes
Oct 27, 2026
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.
Summary of Changes
This pull request resolves a substring bounds calculation bug and index-out-of-bounds edge cases in
TextParseNode, and adds test coverage forTextSerializationWriter:TextParseNode, whenrawTextstarts and ends with double quotes,rawText.substring(1, rawText.length() - 2)previously evaluated with an off-by-one upper bound. In Java,substring(begin, end)is exclusive ofend, meaninglength() - 2dropped the trailing character of the inner content (e.g."\"hello world\""became"hello worl"). The end index is corrected torawText.length() - 1.rawText.length() >= 2guard before attempting quote stripping. Previously:"\"\"", length 2) evaluatedrawText.length() - 2 == 0, throwingStringIndexOutOfBoundsExceptiononsubstring(1, 0)."\"", length 1) matched bothstartsWith("\"")andendsWith("\""), throwingStringIndexOutOfBoundsExceptiononsubstring(1, -1).TextParseNodeTestfor quoted strings, empty quoted strings, single quote strings, and unquoted strings.TextSerializationWriterTestcovering string, boolean, integer, and byte array serialization, single-value restrictions, and structured data rejection.Verification
./gradlew :components:serialization:text:spotlessCheck.components/serialization/textpass: 15 passing tests.