groovy
  1. groovy
  2. GROOVY-4784

[ null, 'ah' ].findAll() throws a NullPointerException

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.8.1
    • Component/s: groovy-jdk
    • Labels:
      None
    • Environment:
      This box right here.
    • Testcase included:
      yes
    • Number of attachments :
      0

      Description

      [ null, 'ah' ].findAll()
      

      throws a NullPointerException with no error message which is a bit odd because I can write [][1] and get null back.

      Essentially, Groovy is very lax (in a good way) in most parts but not here.

      I'd implement a default Closure that just casts each argument to boolean, which i think [ null, 'ah' ].findAll

      { it }

      would.

      This might apply to more methods than just findAll().

        Activity

        Hide
        Paul King added a comment -

        Due to GROOVY-4893, this is now fixed

        Show
        Paul King added a comment - Due to GROOVY-4893 , this is now fixed

          People

          • Assignee:
            Paul King
            Reporter:
            Johann Burkard
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: