groovy
  1. groovy
  2. GROOVY-5280

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

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8.4
    • Fix Version/s: 1.8.6, 2.0-beta-3
    • Component/s: XML Processing
    • Labels:
      None
    • Environment:
      any
    • Number of attachments :
      0

      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()

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Paul King
            Reporter:
            Brad Whitaker
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: