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

DOMCategory.setValue is unable to handle newly created elements

    XMLWordPrintableJSON

Details

    Description

      If a newly created element has no children then a NullPointerException is thrown.

      IMO in these cases the method should create a new TextElement and add the contents to it.

      How to reproduce:

      import groovy.xml.dom.DOMCategory
      
      use(DOMCategory) {
          def prop = doc.createElement('property')
          prop.setAttribute('name', 'cache.class')
          prop.setValue('true')
      }
      

      Attachments

        Activity

          People

            paulk Paul King
            ragedog Marek Baluch
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: