You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (JIRA)" <ji...@apache.org> on 2018/12/22 08:16:00 UTC

[jira] [Created] (GROOVY-8936) NPE occurred when `null` message passed into `MissingPropertyException`

Daniel Sun created GROOVY-8936:
----------------------------------

             Summary: NPE occurred when `null` message passed into `MissingPropertyException`
                 Key: GROOVY-8936
                 URL: https://issues.apache.org/jira/browse/GROOVY-8936
             Project: Groovy
          Issue Type: Bug
            Reporter: Daniel Sun
            Assignee: Daniel Sun
             Fix For: 3.0.0-alpha-4


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 {{getMessage}}, {{toString}}, 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.)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)