You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2015/08/30 08:31:45 UTC

[jira] [Commented] (GROOVY-7519) JsonOuput.toJson() leads to StackOverflowException

    [ https://issues.apache.org/jira/browse/GROOVY-7519?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14721416#comment-14721416 ] 

ASF GitHub Bot commented on GROOVY-7519:
----------------------------------------

GitHub user eginez opened a pull request:

    https://github.com/apache/incubator-groovy/pull/105

    GROOVY-7519: Fixes JsonOuput.toJson() leads to StackOverflowException

    JsonOutput overflows when serializing a File due to recursive references to File objects. Namely getAbsoluteFile(), getCanonicalFile(), and getParentFile(). These properties will be properly serialized by their counterpart methods getAbsolutePath(), getCanonicalPath() and getParent().

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/eginez/incubator-groovy master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-groovy/pull/105.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #105
    
----
commit 60ffaef99ec9ec48797188d3586cebdcffe8aea5
Author: Esteban <eg...@gmail.com>
Date:   2015-08-30T06:20:07Z

    GROOVY-7519: Fixes JsonOuput.toJson() leads to StackOverflowException

----


> JsonOuput.toJson() leads to StackOverflowException
> --------------------------------------------------
>
>                 Key: GROOVY-7519
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7519
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.4.4
>            Reporter: dariusan
>            Priority: Critical
>
> If one wants to generate JSON with groovy.json.JsonOutpout that contains a java.io.File object as property in the object hierarchy a StackOverflowException is thrown
> {code}
> groovy.json.JsonOutput.toJson(new File('.'))
> java.lang.StackOverflowError
> 	at groovy.json.internal.CharBuf.addLong(CharBuf.java:788)
> 	at groovy.json.JsonOutput.writeNumber(JsonOutput.java:216)
> 	at groovy.json.JsonOutput.writeObject(JsonOutput.java:264)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)