You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Sébastien Gadot (JIRA)" <ji...@apache.org> on 2018/12/12 07:30:00 UTC

[jira] [Closed] (GROOVY-8916) JsonOutput unable to serialize Locale object

     [ https://issues.apache.org/jira/browse/GROOVY-8916?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sébastien Gadot closed GROOVY-8916.
-----------------------------------

Update to 2.5 and use JsonGenerator

> JsonOutput unable to serialize Locale object
> --------------------------------------------
>
>                 Key: GROOVY-8916
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8916
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 2.4.15
>            Reporter: Sébastien Gadot
>            Priority: Minor
>             Fix For: 2.5.x
>
>
> Trying to serialize an object containing a Locale throws StackOverflowException
> example :
>  
>  
> {code:java}
> JsonOutput.toJson([loc: Locale.FRANCE])
> // expected {"loc": "fr_FR"}
> // got StackOverflowException
> {code}
> {code:java}
> java.lang.StackOverflowError
> at java.lang.reflect.InvocationTargetException.<init>(InvocationTargetException.java:72)
> at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
> at groovy.lang.MetaBeanProperty.getProperty(MetaBeanProperty.java:59)
> at groovy.lang.PropertyValue.getValue(PropertyValue.java:42)
> at org.codehaus.groovy.runtime.DefaultGroovyMethods.getProperties(DefaultGroovyMethods.java:474)
> at groovy.json.JsonOutput.getObjectProperties(JsonOutput.java:338)
> at groovy.json.JsonOutput.writeObject(JsonOutput.java:331)
> at groovy.json.JsonOutput.writeMap(JsonOutput.java:469)
> at groovy.json.JsonOutput.writeObject(JsonOutput.java:332)
> at groovy.json.JsonOutput.writeMap(JsonOutput.java:469)
> {code}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)