From a541da3120a14c97b2b52e10260c9ded868f1aa0 Mon Sep 17 00:00:00 2001 From: Dominik Zarzecki Date: Tue, 27 Jun 2023 10:00:40 +0200 Subject: [PATCH] Update Jackson to 2.15 --- json/json-core/dependencies.sbt | 2 +- .../src/main/scala/io/sphere/json/package.scala | 3 ++- .../io/sphere/json/SphereJsonParserSpec.scala | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 json/json-core/src/test/scala/io/sphere/json/SphereJsonParserSpec.scala diff --git a/json/json-core/dependencies.sbt b/json/json-core/dependencies.sbt index 4795c39e..fdf1c6e0 100644 --- a/json/json-core/dependencies.sbt +++ b/json/json-core/dependencies.sbt @@ -1,5 +1,5 @@ libraryDependencies ++= Seq( "org.json4s" %% "json4s-jackson" % "4.0.6", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.14.2", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.15.2", "org.typelevel" %% "cats-core" % "2.9.0" ) diff --git a/json/json-core/src/main/scala/io/sphere/json/package.scala b/json/json-core/src/main/scala/io/sphere/json/package.scala index e3fa678a..b0ae1401 100644 --- a/json/json-core/src/main/scala/io/sphere/json/package.scala +++ b/json/json-core/src/main/scala/io/sphere/json/package.scala @@ -3,7 +3,7 @@ package io.sphere import cats.data.Validated.{Invalid, Valid} import cats.data.{NonEmptyList, ValidatedNel} import com.fasterxml.jackson.core.JsonParseException -import com.fasterxml.jackson.core.exc.InputCoercionException +import com.fasterxml.jackson.core.exc.{InputCoercionException, StreamConstraintsException} import com.fasterxml.jackson.databind.JsonMappingException import io.sphere.util.Logging import org.json4s.{DefaultFormats, JsonInput, StringInput} @@ -28,6 +28,7 @@ package object json extends Logging { case e: JsonMappingException => jsonParseError(e.getOriginalMessage) case e: JsonParseException => jsonParseError(e.getOriginalMessage) case e: InputCoercionException => jsonParseError(e.getOriginalMessage) + case e: StreamConstraintsException => jsonParseError(e.getOriginalMessage) } def parseJSON(json: String): JValidation[JValue] = diff --git a/json/json-core/src/test/scala/io/sphere/json/SphereJsonParserSpec.scala b/json/json-core/src/test/scala/io/sphere/json/SphereJsonParserSpec.scala new file mode 100644 index 00000000..024348fd --- /dev/null +++ b/json/json-core/src/test/scala/io/sphere/json/SphereJsonParserSpec.scala @@ -0,0 +1,14 @@ +package io.sphere.json + +import org.scalatest.matchers.must.Matchers +import org.scalatest.wordspec.AnyWordSpec + +class SphereJsonParserSpec extends AnyWordSpec with Matchers { + "Object mapper" must { + + "accept strings with 20_000_000 bytes" in { + SphereJsonParser.mapper.getFactory.streamReadConstraints().getMaxStringLength must be( + 20000000) + } + } +}