Skip to content

Commit e755834

Browse files
committed
ScalaObjectDeserializer must read the tokens up end-object
1 parent c4382c0 commit e755834

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/main/scala/tools/jackson/module/scala/deser/ScalaObjectDeserializerModule.scala

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package tools.jackson.module.scala.deser
22

3-
import tools.jackson.core.JsonParser
3+
import tools.jackson.core.{JsonParser, JsonToken}
44
import tools.jackson.databind.JacksonModule.SetupContext
55
import tools.jackson.databind.deser.Deserializers
66
import tools.jackson.databind.deser.std.StdDeserializer
@@ -12,7 +12,14 @@ import tools.jackson.module.scala.util.ClassW
1212
import scala.languageFeature.postfixOps
1313

1414
private class ScalaObjectDeserializer(value: Any) extends StdDeserializer[Any](classOf[Any]) {
15-
override def deserialize(p: JsonParser, ctxt: DeserializationContext): Any = value
15+
override def deserialize(p: JsonParser, ctxt: DeserializationContext): Any = {
16+
if (p.currentToken() != JsonToken.END_OBJECT) {
17+
while (p.nextToken() != JsonToken.END_OBJECT) {
18+
// consume the object
19+
}
20+
}
21+
value
22+
}
1623
}
1724

1825
private class ScalaObjectDeserializerResolver(config: ScalaModule.Config) extends Deserializers.Base {

0 commit comments

Comments
 (0)