Groovy
  1. Groovy
  2. GROOVY-5280

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

    Details

    • Type: Bug Bug
    • Status: 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

      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

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        23h 11m 1 Paul King 05/Feb/12 00:28
        Resolved Resolved Closed Closed
        7d 3h 34m 1 Paul King 12/Feb/12 04:03
        Mark Thomas made changes -
        Workflow jira [ 12971675 ] Default workflow, editable Closed status [ 12979470 ]
        Mark Thomas made changes -
        Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
        Mark Thomas made changes -
        Workflow jira [ 12734203 ] Default workflow, editable Closed status [ 12745960 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
        Paul King made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Paul King made changes -
        Fix Version/s 1.8.6 [ 18245 ]
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.0-beta-3 [ 18244 ]
        Hide
        Paul King added a comment -

        Fixed. Thanks for the suggestion Brad.

        Show
        Paul King added a comment - Fixed. Thanks for the suggestion Brad.
        Paul King made changes -
        Field Original Value New Value
        Assignee Paul King [ paulk ]
        Brad Whitaker created issue -

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development