You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by Paolo Di Tommaso <pa...@gmail.com> on 2017/11/24 20:16:10 UTC

ConfigSlurper issue

It was my understanding that a ConfigObject dot notation is equivalent to
curly brackets.

However the following snippets create two different objects


def first = '''
        alpha.container = 'foo'

        profiles {
            beta.container='x/y'
            delta.container='1/2'
            alpha.container='bar'
        }
        '''

def second = '''
        alpha.container = 'foo'

        profiles.beta.container='x/y'
        profiles.delta.container='1/2'
        profiles.alpha.container='bar'
        '''

assert new ConfigSlurper().parse(first) == new
ConfigSlurper().parse(second)     // fail



in particular printing the first ConfigObject it return the following
string:


alpha.container='bar'
profiles {
beta.container='x/y'
delta.container='1/2'
}


that doesn't make much sense. Is this a bug or I'm missing something?



Cheers,
Paolo

Re: ConfigSlurper issue

Posted by Paolo Di Tommaso <pa...@gmail.com>.
I've opened an issue for this problem.

https://issues.apache.org/jira/browse/GROOVY-8390


I've also tried to debug it, but I was unable to find a solution. Any help
would be appreciated.


Cheers,
Paolo


On Fri, Nov 24, 2017 at 9:16 PM, Paolo Di Tommaso <paolo.ditommaso@gmail.com
> wrote:

> It was my understanding that a ConfigObject dot notation is equivalent to
> curly brackets.
>
> However the following snippets create two different objects
>
>
> def first = '''
>         alpha.container = 'foo'
>
>         profiles {
>             beta.container='x/y'
>             delta.container='1/2'
>             alpha.container='bar'
>         }
>         '''
>
> def second = '''
>         alpha.container = 'foo'
>
>         profiles.beta.container='x/y'
>         profiles.delta.container='1/2'
>         profiles.alpha.container='bar'
>         '''
>
> assert new ConfigSlurper().parse(first) == new
> ConfigSlurper().parse(second)     // fail
>
>
>
> in particular printing the first ConfigObject it return the following
> string:
>
>
> alpha.container='bar'
> profiles {
> beta.container='x/y'
> delta.container='1/2'
> }
>
>
> that doesn't make much sense. Is this a bug or I'm missing something?
>
>
>
> Cheers,
> Paolo
>
>
>