Details
-
Sub-task
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.7.5, 1.8-beta-2
-
None
-
None
-
windows 7; java version "1.6.0_21; gdk I.7.5 but also occurs for gdk 1.8.0 beta 2.
Description
package tasktrack; import groovy.util.GroovyTestCase; class ConfigSurlperTest extends GroovyTestCase { public void testParseScript() { def configFile = ''' log4j { rootLogger="debug,stdout" appender { stdout("org.apache.log4j.ConsoleAppender") { // See Note 2 layout("org.apache.log4j.PatternLayout") { ConversionPattern="%5p [%t] (%F:%L) - %m%n" } } } } ''' def cfg = new ConfigSlurper().parse(configFile) assertEquals "debug,stdout", cfg.log4j.rootLogger //Pass assertEquals "org.apache.log4j.ConsoleAppender", cfg.log4j.appender.stdout //Pass assertEquals "org.apache.log4j.PatternLayout", cfg.log4j.appender.stdout.layout // Fails - See Note 1 } }
Note 1
======
Result in the following exception
groovy.lang.MissingPropertyException: No such property: layout for class: java.lang.String
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:49)
at org.codehaus.groovy.runtime.callsite.GetEffectivePojoPropertySite.getProperty(GetEffectivePojoPropertySite.java:63)
...
Note 2
======
The third assert works when the value, org.apache.log4j.ConsoleAppender, is not declared.
That is:
...
appender {
stdout {
layout("org.apache.log4j.PatternLayout")
}
}
...