Skip to content

Commit

Permalink
Merge branch 'main' into steward
Browse files Browse the repository at this point in the history
  • Loading branch information
pjfanning authored Dec 28, 2024
2 parents 633bd8e + cc97e82 commit ccb31b2
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .scala-steward.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ updates.ignore = [

updates.pin = [
# pin to jackson version used in pekko-core
{ groupId = "com.fasterxml.jackson.core", version = "2.17." },
{ groupId = "com.fasterxml.jackson.dataformat", version = "2.17." },
{ groupId = "com.fasterxml.jackson.core", version = "2.18." },
{ groupId = "com.fasterxml.jackson.dataformat", version = "2.18." },
# specs2 v5 needs newer java version
{ groupId = "org.specs2", artifactId = "specs2-core", version = "4." },
# https://github.com/akka/akka-http/pull/4080#issuecomment-1074853622
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ static ObjectMapper createMapper(final Config config) {
.maxStringLength(config.getInt("read.max-string-length"))
.maxNameLength(config.getInt("read.max-name-length"))
.maxDocumentLength(config.getLong("read.max-document-length"))
.maxTokenCount(config.getLong("read.max-token-count"))
.build();
StreamWriteConstraints streamWriteConstraints =
StreamWriteConstraints.builder()
Expand All @@ -126,16 +127,14 @@ private static RecyclerPool<BufferRecycler> getBufferRecyclerPool(final Config c
switch (poolType) {
case "thread-local":
return JsonRecyclerPools.threadLocalPool();
case "lock-free":
return JsonRecyclerPools.newLockFreePool();
case "shared-lock-free":
return JsonRecyclerPools.sharedLockFreePool();
case "concurrent-deque":
return JsonRecyclerPools.newConcurrentDequePool();
case "shared-concurrent-deque":
return JsonRecyclerPools.sharedConcurrentDequePool();
case "bounded":
return JsonRecyclerPools.newBoundedPool(cfg.getInt("buffer-recycler.bounded-pool-size"));
case "non-recycling":
return JsonRecyclerPools.nonRecyclingPool();
default:
throw new IllegalArgumentException("Unknown recycler-pool: " + poolType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,29 @@

pekko.http.marshallers.jackson {
read {
# see https://www.javadoc.io/static/com.fasterxml.jackson.core/jackson-core/2.17.1/com/fasterxml/jackson/core/StreamReadConstraints.html
# see https://www.javadoc.io/static/com.fasterxml.jackson.core/jackson-core/2.18.2/com/fasterxml/jackson/core/StreamReadConstraints.html
# these defaults are the same as the defaults in `StreamReadConstraints`
max-nesting-depth = 1000
max-number-length = 1000
max-string-length = 20000000
max-name-length = 50000
# max-document-length of -1 means unlimited
max-document-length = -1
# max-token-count of -1 means unlimited
max-token-count = -1
}

write {
# see https://www.javadoc.io/static/com.fasterxml.jackson.core/jackson-core/2.17.1/com/fasterxml/jackson/core/StreamWriteConstraints.html
# see https://www.javadoc.io/static/com.fasterxml.jackson.core/jackson-core/2.18.2/com/fasterxml/jackson/core/StreamWriteConstraints.html
# these defaults are the same as the defaults in `StreamWriteConstraints`
max-nesting-depth = 1000
}

# Controls the Buffer Recycler Pool implementation used by Jackson.
# https://javadoc.io/static/com.fasterxml.jackson.core/jackson-core/2.17.1/com/fasterxml/jackson/core/util/JsonRecyclerPools.html
# The default is "thread-local" which is the same as the default in Jackson 2.16.
# https://javadoc.io/static/com.fasterxml.jackson.core/jackson-core/2.18.2/com/fasterxml/jackson/core/util/JsonRecyclerPools.html
# The default is "thread-local" which is the same as the default in Jackson 2.18.
buffer-recycler {
# the supported values are "thread-local", "lock-free", "shared-lock-free", "concurrent-deque",
# "shared-concurrent-deque", "bounded"
# the supported values are "thread-local", "concurrent-deque", "shared-concurrent-deque", "bounded", "non-recycling"
pool-instance = "thread-local"
# the maximum size of bounded recycler pools - must be >=1 or an IllegalArgumentException will occur
# only applies to pool-instance type "bounded"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public void configStreamReadsConstraints() throws Exception {
final int maxNameLen = 54321;
final int maxStringLen = 1234567;
final long maxDocLen = 123456789L;
final long maxTokenCount = 9876543210L;
final int maxNestingDepth = 5;
String configText =
"read.max-number-length="
Expand All @@ -108,6 +109,9 @@ public void configStreamReadsConstraints() throws Exception {
+ "read.max-document-length="
+ maxDocLen
+ "\n"
+ "read.max-token-count="
+ maxTokenCount
+ "\n"
+ "read.max-nesting-depth="
+ maxNestingDepth;
Config config = ConfigFactory.parseString(configText).withFallback(getDefaultConfig());
Expand All @@ -117,6 +121,7 @@ public void configStreamReadsConstraints() throws Exception {
assertEquals(maxNameLen, constraints.getMaxNameLength());
assertEquals(maxStringLen, constraints.getMaxStringLength());
assertEquals(maxDocLen, constraints.getMaxDocumentLength());
assertEquals(maxTokenCount, constraints.getMaxTokenCount());
assertEquals(maxNestingDepth, constraints.getMaxNestingDepth());
}

Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import scala.language.implicitConversions
object Dependencies {
import DependencyHelpers._

val jacksonDatabindVersion = "2.17.3"
val jacksonDatabindVersion = "2.18.2"
val jacksonXmlVersion = jacksonDatabindVersion
val junitVersion = "4.13.2"
val h2specVersion = "2.6.0"
Expand Down

0 comments on commit ccb31b2

Please sign in to comment.