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

ConfigObject doesn't fully create hierarchy

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.8.0, 1.8.1
    • Fix Version/s: None
    • Component/s: groovy-jdk
    • Labels:
      None
    • Environment:
      windows 7 64 bit, jdk 1.6.0_25 (32bit)

      Description

      When writing a ConfigObject with a deep hierarchy, where some levels have no siblings, to file, some levels of the hierarchy get lost.

      See the following code snipet

      def config = new ConfigObject()
      config.db.hibernate.connection.url='jdbc:h2:file:C:/Temp/database;AUTO_SERVER=true'
      config.db.hibernate.connection.username='sa'
      config.db.hibernate.connection.password=''
      
      def file = new File('C:/Temp/config.groovy')
      file.withWriter { writer ->
          config.writeTo(writer)
      }
      

      This produces a file like this:

      connection {
      	url="jdbc:h2:file:C:/Temp/database;AUTO_SERVER=true"
      	username="sa"
      	password=""
      }
      

      What I would expect is:

      db {
      	hibernate {
      		connection {
      			url="jdbc:h2:file:C:/Temp/database;AUTO_SERVER=true"
      			username="sa"
      			password=""
      		}
      	}
      }
      

        Attachments

        1. Groovy4957Bug.groovy
          2 kB
          Dieter Rehbein
        2. ConfigObjectWriter.groovy
          2 kB
          Dieter Rehbein
        3. ConfigObject.groovy
          7 kB
          Dieter Rehbein
        4. ConfigObject.diff
          6 kB
          Dieter Rehbein

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              erpl Erich Paul
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: