Groovy
  1. Groovy
  2. GROOVY-7728

LAX parser: Commenting out key/val pairs doesn't work

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4.5
    • Fix Version/s: 2.4.7
    • Component/s: JSON
    • Labels:
      None
    • Environment:
      Linux OpenJDK 7 (java version "1.7.0_91")

      Description

      This is in regards to JsonParserType.LAX. I'm calling it with this code:

      def slurpOpts = new JsonSlurper().setType(JsonParserType.LAX).parse(new File(ConfigFileName))
      
      slurpOpts.each {k, v -> myOpts.put(k, slurpOpts.get(k))}
      

      Here is my JSON. appUserId is parsed but it should be commented out. The key baseFolderName is correctly commented out.

      {
          "enterpriseDomain": "@example.com"
          ,"enterpriseId": "123456"
          ,"clientId": "abcdefghijklmnopqrstuvwxyz123456"
          ,"clientSecret": "abcdefghijklmnopqrstuvwxyz123456"
          ,"keyId": "12345678"
          ,"keyFileName": "/etc/PrintToBox/PrintToBox_private_key.pem"
          ,"keyPassword": "12345678901234567890"
          // ,"appUserId": "123456789" 
      
          //  Optional parameters with defaults shown
          // ,"baseFolderName": "PrintToBox"
      }
      

        Activity

        Hide
        ASF GitHub Bot added a comment -

        GitHub user jwagenleitner opened a pull request:

        https://github.com/apache/groovy/pull/322

        GROOVY-7728 - LAX parser: Commenting out key/val pairs doesn't work

        Changed loop to process comments and end of object marker after processing
        key/values because skipWhitespace leaves the cursor on the first
        non-whitespace character and that character needs to be processed before
        the loop increments the index counter. This same logic is used by
        JsonFastParser#decodeJsonObjectLazyFinalParse.

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

        $ git pull https://github.com/jwagenleitner/groovy GROOVY-7728

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

        https://github.com/apache/groovy/pull/322.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 #322


        commit af3800f4f6534e0771b624b7d8bc99bd2d0f6a93
        Author: John Wagenleitner <jwagenleitner@apache.org>
        Date: 2016-04-27T00:07:45Z

        GROOVY-7728 - LAX parser: Commenting out key/val pairs doesn't work

        Changed loop to process comments and end of object marker after processing
        key/values because skipWhitespace leaves the cursor on the first
        non-whitespace character and that character needs to be processed before
        the loop increments the index counter. This same logic is used by
        JsonFastParser#decodeJsonObjectLazyFinalParse.


        Show
        ASF GitHub Bot added a comment - GitHub user jwagenleitner opened a pull request: https://github.com/apache/groovy/pull/322 GROOVY-7728 - LAX parser: Commenting out key/val pairs doesn't work Changed loop to process comments and end of object marker after processing key/values because skipWhitespace leaves the cursor on the first non-whitespace character and that character needs to be processed before the loop increments the index counter. This same logic is used by JsonFastParser#decodeJsonObjectLazyFinalParse. You can merge this pull request into a Git repository by running: $ git pull https://github.com/jwagenleitner/groovy GROOVY-7728 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/322.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 #322 commit af3800f4f6534e0771b624b7d8bc99bd2d0f6a93 Author: John Wagenleitner <jwagenleitner@apache.org> Date: 2016-04-27T00:07:45Z GROOVY-7728 - LAX parser: Commenting out key/val pairs doesn't work Changed loop to process comments and end of object marker after processing key/values because skipWhitespace leaves the cursor on the first non-whitespace character and that character needs to be processed before the loop increments the index counter. This same logic is used by JsonFastParser#decodeJsonObjectLazyFinalParse.
        Hide
        ASF GitHub Bot added a comment -

        Github user asfgit closed the pull request at:

        https://github.com/apache/groovy/pull/322

        Show
        ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/groovy/pull/322
        Hide
        John Wagenleitner added a comment -

        Thanks for reporting the issue.

        Show
        John Wagenleitner added a comment - Thanks for reporting the issue.

          People

          • Assignee:
            John Wagenleitner
            Reporter:
            Stephen Olander-Waters
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development