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

Problem With MarkupBuilder In Static Method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0
    • 1.1-beta-3
    • XML Processing
    • None
    • Mac OS X, groovy 1.0

    Description

      I am seeing odd behavior when I try to use a MarkupBuilder in a static method. The following fails with a MissingMethodException (waba is the missing method):

      Foo.groovy
      class Foo {
      
        static void main(args) {
      	def xml = new groovy.xml.MarkupBuilder()
      	def configMap = [name:'Jeff']
      
      	xml.foo {
      		configMap.each { key, value ->
      			waba(name:'bar')
      		}
      	}
        }
      }
      

      The following seems to work fine:

      Foo.groovy
      class Foo {
      
        static void main(args) {
      	new Foo() 
        }
        
        public Foo() {
      	def xml = new groovy.xml.MarkupBuilder()
      	def configMap = [name:'Jeff']
      
      	xml.foo {
      		configMap.each { key, value ->
      			waba(name:'bar')
      		}
      	}
        }
      }
      

      Attachments

        Activity

          People

            paulk Paul King
            brownj Jeff Brown
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: