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

GPath inconsistency

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6.2
    • 1.6.3, 1.7-beta-1
    • None
    • None

    Description

      The issue was created out of the following discussion from the Groovy dev mailing-list:
      http://www.nabble.com/Inconsistency-in-GPath-td23427805.html

      The following code fails with an NPE:

      def data = [
          [a: null],
          [a: [b: 1]],
          [a: [b: 2]]
      ]
      
      assert data.a.b.sum() == 3
      

      On a DOM that would have been parsed out of some XML feed, the result would have been 3, as expected, but on a normal object graph (or here with nested lists/maps) it fails with an NPE.

      Attachments

        Activity

          People

            guillaume Guillaume Sauthier
            guillaume Guillaume Sauthier
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: