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

DOMCategory: NullPointerException in setValue() when element has no text

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.8.4
    • 1.8.6, 2.0-beta-3
    • XML Processing
    • None
    • any

    Description

      NullPointerException at groovy.xml.dom.DOMCategory.setValue(DOMCategory.java:261) if setting value on element that has no text.

      Example is to modify input in the example shown on the "Updating XML with DOMCategory" page (http://groovy.codehaus.org/Updating+XML+with+DOMCategory) to include an empty<item/> element, like this:

      ...
      <category type="groceries">
      <item>Chocolate</item>
      <item>Coffee</item>
      <item/>
      </category>
      ...

      This modification to input causes NullPointerException at this line in the
      example:

      g.value = 'Luxury ' + g.text()

      Attachments

        Activity

          People

            paulk Paul King
            dbwhitaker Brad Whitaker
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: