Skip to content

Use configured StreamReadConstraints in SmileGenerator.writeNumber(String) - #782

Open
pjfanning wants to merge 1 commit into
FasterXML:3.xfrom
pjfanning:smile-gen-read-constraints
Open

pjfanning wants to merge 1 commit into
FasterXML:3.xfrom
pjfanning:smile-gen-read-constraints

Conversation

@pjfanning

Copy link
Copy Markdown
Member

Fixes #781.

SmileGenerator._streamReadConstraints() — used by _writeIntegralNumber() / _writeDecimalNumber() to guard writeNumber(String) against over-long number Strings — returned StreamReadConstraints.defaults(), so a maxNumberLength configured on the SmileFactory was ignored on the write path (lower limits not enforced, higher limits spuriously rejected).

Now returns _ioContext.streamReadConstraints(), i.e. the factory's configured instance.

Adds SmileGeneratorNumbersTest.testNumbersAsStringLengthLimit covering both the integral and decimal paths, plus a round-trip at the limit.

🤖 Generated with Claude Code

…ring) (FasterXML#781)

`_streamReadConstraints()` returned `StreamReadConstraints.defaults()`, so a
`maxNumberLength` configured on the `SmileFactory` was ignored by the
number-length guard in `writeNumber(String)`. Use the factory's constraints
via `IOContext` instead.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(smile) SmileGenerator.writeNumber(String) validates number length against default StreamReadConstraints instead of configured ones

1 participant