support "unlimited" for the Jackson stream-read constraints - #3522
Open
pjfanning wants to merge 1 commit into
Open
support "unlimited" for the Jackson stream-read constraints#3522pjfanning wants to merge 1 commit into
pjfanning wants to merge 1 commit into
Conversation
Motivation: Review on apache#3515 preferred an explicit keyword over -1 as a magic number for unlimited. Among the configuration listed in apache#3513, the Jackson read constraints max-document-length and max-token-count document -1 as meaning unlimited but only accept numbers. Modification: JacksonObjectMapperProvider in serialization-jackson and serialization-jackson3 reads "unlimited" as -1 for read.max-document-length and read.max-token-count, and the reference.conf defaults are written as `unlimited`. A negative number such as -1 is still accepted. Result: `max-document-length = unlimited` and `max-token-count = unlimited` work; the effective defaults are unchanged. Tests: - sbt "serialization-jackson/testOnly org.apache.pekko.serialization.jackson.*" - 129 passed - sbt "serialization-jackson3/testOnly org.apache.pekko.serialization.jackson3.*" - 127 passed - sbt "serialization-jackson/scalafmtCheckAll" "serialization-jackson3/scalafmtCheckAll" - clean References: Refs apache#3513, Refs apache#3515
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.
Motivation
Review on #3515 preferred an explicit
unlimitedkeyword over-1as a magic number.Auditing the configuration listed in #3513 for other
-1-means-unlimited settings turnedup exactly one family: the Jackson stream-read constraints
read.max-document-lengthandread.max-token-count, whose comments say "-1 means unlimited" but which only acceptnumbers (
getLong).Nothing else in that list qualifies: the other new settings are durations, counts with
real defaults, booleans or strings, and
fork-join-executor.minimum-runnable = -1means"JDK-aware default" — not unlimited — so the keyword would be wrong there.
compression.max-decompressed-sizealready gainsunlimitedin #3515.Modification
JacksonObjectMapperProviderin bothserialization-jacksonandserialization-jackson3readsunlimitedas-1forread.max-document-lengthandread.max-token-count, and the reference.conf defaults are written asunlimited. Anegative number such as
-1is still accepted, so existing overrides keep working.Both modules are changed together so the jackson3 section keeps mirroring the jackson
one, per the migration guide.
Result
max-document-length = unlimitedandmax-token-count = unlimitedwork in bothmodules; the effective defaults are unchanged.
Tests
support unlimited as a StreamReadConstraints valuetest in each module'sJacksonFactorySpec, asserting the builtStreamReadConstraintscarries-1sbt "serialization-jackson/testOnly org.apache.pekko.serialization.jackson.*"— 129 passedsbt "serialization-jackson3/testOnly org.apache.pekko.serialization.jackson3.*"— 127 passedsbt "serialization-jackson/scalafmtCheckAll" "serialization-jackson3/scalafmtCheckAll"— cleanCheck / Binary Compatibilityjob; the only code change is a privatehelper
References
Refs #3513, Refs #3515