Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-6304 Configslurper Issues
  3. GROOVY-5194

ConfigSluper cannot re-parse a file written by itself.

    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.8.3
    • Fix Version/s: None
    • Component/s: groovy-jdk
    • Labels:
    • Environment:
      winxp, jdk6

      Description

      config file is as below:

      list('XX') {
      one {
      a = 100
      b = 200
      c {
      x1 = "x1"
      x2

      { y1 = 1 }

      }
      }

      two = "2000"
      }

      ConfigSlurper can parse correctly. But when call its writeTo method to a file, the file like this:

      list="XX"
      one."list.a"=100
      one."list.b"=200
      one"list.x1"="x1"
      onex2."list.y1"=1
      "list.two"="2000"

      This output file cannot be re-parsed.
      The error message in stdout as below:
      [list:XX, one:[list.a:100, list.b:200, c:[list.x1:x1, x2:[list.y1:1]]], list.two:2000]
      XX
      2000
      2000
      100
      x1
      x1
      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      script13238783009061342328505.groovy: 4:
      [list.x1] is a constant expression, but it should be a variable expression at line: 4 column: 13. File: script13238783009061342328505.groovy @ line 4, column 13.
      one"list.x1"="x1"
      ^

      1 error

        Attachments

        1. config.txt
          0.1 kB
          Chenyang XING
        2. Config.groovy
          0.2 kB
          Chenyang XING
        3. TestConfigSlurper.groovy
          0.4 kB
          Chenyang XING

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              idealforce Chenyang XING
            • Votes:
              3 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated: