groovy
  1. groovy
  2. GROOVY-4231

DOMCategory.setValue is unable to handle newly created elements

    Details

    • Number of attachments :
      0

      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')
      }
      

        Activity

        Hide
        Paul King added a comment -

        add code tags

        Show
        Paul King added a comment - add code tags
        Hide
        Marek Baluch added a comment -

        Thanks for the tip.

        Show
        Marek Baluch added a comment - Thanks for the tip.
        Hide
        Paul King added a comment -

        I believe this was fixed as part of GROOVY-5280. Let me know if you have any further problems. Thanks for reporting the issue.

        Show
        Paul King added a comment - I believe this was fixed as part of GROOVY-5280 . Let me know if you have any further problems. Thanks for reporting the issue.

          People

          • Assignee:
            Paul King
            Reporter:
            Marek Baluch
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: