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

NPE occurred when `null` message passed into `MissingPropertyException`

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0.0-alpha-4
    • Component/s: None
    • Labels:
      None

      Description

      Reported by Jesse Glick( https://github.com/jglick )

       

      https://github.com/apache/groovy/pull/844

      Otherwise you get errors like

      groovy.lang.MissingPropertyExceptionTest > testNullMessage FAILED java.lang.NullPointerException at groovy.lang.MissingPropertyException.getMessageWithoutLocationText(MissingPropertyException.java:66) at groovy.lang.GroovyRuntimeException.getMessage(GroovyRuntimeException.java:63) at java.lang.Throwable.getLocalizedMessage(Throwable.java:391) at java.lang.Throwable.toString(Throwable.java:480) at junit.framework.Assert.assertNull(Assert.java:268) at junit.framework.TestCase.assertNull(TestCase.java:438) at groovy.lang.MissingPropertyExceptionTest.testNullMessage(MissingPropertyExceptionTest.java:29) 
      

      it is unclear what null values for property and type would mean, but there is a constructor explicitly allowing that, and it is illegal for getMessagetoString, etc. to throw an undeclared NPE.

      (A MissingPropertyException producing this error was originally observed as a build failure in a Jenkins project, though I do not have the details to know the root cause there.)

        Attachments

          Activity

            People

            • Assignee:
              daniel_sun Daniel Sun
              Reporter:
              daniel_sun Daniel Sun
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: