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

JsonOutput.prettyPrint generates string with null bytes on OpenJ9 JVM

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.5.9
    • None
    • JSON
    • None

    Description

      Using OpenJDK with Eclipse OpenJ9 JVM from https://adoptopenjdk.net/, the method JsonOutput.prettyPrint() generates a string which contains null bytes.

      Test code

      import groovy.json.JsonOutput
      
      String s = JsonOutput.prettyPrint('{"id":123}')
      println s.getBytes().encodeHex().toString()
      println s
      

      Expected output

      7b0a20202020226964223a203132330a7d
      {
          "id": 123
      }
      

      Actual output

      7b0a20202020226964223a20313233000000000000000000000000000a7d
      {
          "id": 123
      }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            ggiopp Giovanni Pardini
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: