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

JsonBuilder.toString() fails with StackOverflowError when using Expando

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1.0-rc-1
    • Fix Version/s: 2.1.0-rc-3, 2.1.0, 2.0.7
    • Component/s: groovy-jdk
    • Labels:
      None
    • Environment:
       > 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

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

              Dates

              • Created:
                Updated:
                Resolved: