jerkson icon indicating copy to clipboard operation
jerkson copied to clipboard

Huge List of Exceptions on generate()

Open scan opened this issue 12 years ago • 0 comments

I'm having this code:

import play.api.Play.current
import java.util.{Date}
import play.api.libs.json._
import com.codahale.jerkson.Json._

case class Profile(id: String,
                   displayName: Option[String] = None,
                   public: Boolean = false,
                   nsfw: Boolean = false,
                   created: Date = new Date,
                   meta: Map[String, String] = Map.empty) {
    lazy val asJson = generate(this)
}

When I try to evaluate the asJson, I get a load of exceptions, and +2GB of RAM usage. The list so long that I can't get the beginning because the console logs are cut off. Here is a snippet from the beginning, they're the same over and over:


java.lang.reflect.InvocationTargetException: null
    at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source) ~[na:na]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_03]
    at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_03]
    at com.codahale.jerkson.ser.CaseClassSerializer.serialize(CaseClassSerializer.scala:33) ~[jerkson_2.9.1-0.5.0.jar:na]
    at com.codahale.jerkson.ser.CaseClassSerializer.serialize(CaseClassSerializer.scala:12) ~[jerkson_2.9.1-0.5.0.jar:na]
    at org.codehaus.jackson.map.ser.StdSerializerProvider._serializeValue(StdSerializerProvider.java:610) ~[jackson-mapper-asl-1.9.6.jar:1.9.6]
org.codehaus.jackson.map.JsonMappingException: [no message for java.lang.reflect.InvocationTargetException]
    at org.codehaus.jackson.map.ser.StdSerializerProvider._serializeValue(StdSerializerProvider.java:625) ~[jackson-mapper-asl-1.9.6.jar:1.9.6]
    at org.codehaus.jackson.map.ser.StdSerializerProvider.serializeValue(StdSerializerProvider.java:256) ~[jackson-mapper-asl-1.9.6.jar:1.9.6]
    at org.codehaus.jackson.map.ObjectMapper.writeValue(ObjectMapper.java:1613) ~[jackson-mapper-asl-1.9.6.jar:1.9.6]
    at org.codehaus.jackson.impl.JsonGeneratorBase.writeObject(JsonGeneratorBase.java:314) ~[jackson-core-asl-1.9.6.jar:1.9.6]
    at com.codahale.jerkson.Generator$class.generate(Generator.scala:43) ~[jerkson_2.9.1-0.5.0.jar:na]
    at com.codahale.jerkson.Generator$class.generate(Generator.scala:20) ~[jerkson_2.9.1-0.5.0.jar:na]

This also persists when I remove the Map field, so it's not linked to that other issue.

scan avatar Apr 14 '12 16:04 scan