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

ConfigSlurper issue with closures having several parameters

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.0.0
    • None
    • groovy-jdk
    • None

    Description

      I have found this behaviour with groovy 2.0 (I didn't try with another version) which I think is wrong:

      println new ConfigSlurper().parse("x{y{z}}")
      -> [x:[y:[z:[:]]]] (this is what I expect so far)

      println new ConfigSlurper().parse("x('a'){y{z}}")
      -> [x:a, y:[z:[:]]]

      println new ConfigSlurper().parse("x(a){y{z}}")
      -> [a:[:], x:[:], y:[z:[:]]]

      x is no longer a parent of y and z. if a is not a string, then x is not even related to a any-more

      I was trying to do something like that, this example should let you guess the output I had in mind with this formula:

      log4j {
      appender{
      ARoot('org.apache.log4j.ConsoleAppender') {
      layout(''org.apache.log4j.PatternLayout') {
      ConversionPattern'='%d %-5p %c

      {3} - %m%n'
      }
      } // yummy

      instead, I had to opt for this, but it isn't very satisfactory

      log4j {
      appender.ARoot='org.apache.log4j.ConsoleAppender'
      appender.'ARoot.layout'='org.apache.log4j.PatternLayout'
      appender.'ARoot.layout.ConversionPattern'='%d %-5p %c{3}

      - %m%n'
      } // yuk

      Attachments

        Activity

          People

            Unassigned Unassigned
            onenert Olivier Nenert
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: