Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-5918

JsonBuilder.toString() fails with StackOverflowError when using Expando

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.1.0-rc-1
    • 2.1.0-rc-3, 2.1.0, 2.0.7
    • groovy-jdk
    • None
    •  > groovy --version
      Groovy Version: 2.1.0-rc-1 JVM: 1.7.0_09 Vendor: Oracle Corporation OS: Windows 7

    Description

      When JsonBuilder is constructed with an Expando parameter, the toString() method fails with a StackOverflowError. A partial workaround is to convert to use Expando.getProperties() to convert the Expando into a Map, but this fails for any nested Expandos.

      Example code & output are attached.

      Alan Thompson

      Attachments

        1. bug1.groovy
          0.6 kB
          Alan Thompson
        2. bug1.out
          0.3 kB
          Alan Thompson

        Activity

          People

            paulk Paul King
            thompson2526 Alan Thompson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: