[2.0.4 Java] Gson StackOverflowError: null

Showing 1-1 of 1 messages
[2.0.4 Java] Gson StackOverflowError: null Konstantinos Polychronis 11/10/12 3:39 AM
Hello there,
blank project in 2.0.4 with Java, added Gson2.2.2 library, create a simple object use these lines to the controller

Model foobar = new Model();
foobar.name = "foo";
foobar.sirname = "bar";
Gson gson = new GsonBuilder().setPrettyPrinting().create();
String result = gson.toJson(lala);
return ok(result);

Results in:

play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[StackOverflowError: null]]

at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:134) [play_2.9.1.jar:2.0.4]

at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115) [play_2.9.1.jar:2.0.4]

at akka.actor.Actor$class.apply(Actor.scala:318) [akka-actor.jar:2.0.2]

at play.core.ActionInvoker.apply(Invoker.scala:113) [play_2.9.1.jar:2.0.4]

at akka.actor.ActorCell.invoke(ActorCell.scala:626) [akka-actor.jar:2.0.2]

at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:197) [akka-actor.jar:2.0.2]

java.lang.StackOverflowError: null

at com.google.gson.reflect.TypeToken.equals(TypeToken.java:284) ~[gson-2.2.2.jar:na]

at java.util.HashMap.get(HashMap.java:305) ~[na:1.6.0_37]

at java.util.Collections$SynchronizedMap.get(Collections.java:1979) ~[na:1.6.0_37]

at com.google.gson.Gson.getAdapter(Gson.java:337) ~[gson-2.2.2.jar:na]

at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:55) ~[gson-2.2.2.jar:na]

at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89) ~[gson-2.2.2.jar:na]



I tried the "export _JAVA_OPTIONS="-Xms64m -Xmx1024m -Xss2m"" solution from https://play.lighthouseapp.com/projects/82401/tickets/613 with no results. I'm building on MacOs with Java 1.6.

Any idea on what would go wrong?