You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by paulk-asert <gi...@git.apache.org> on 2018/03/19 12:47:47 UTC

[GitHub] groovy pull request #675: GROOVY-8514: NullPointerException in class Missing...

GitHub user paulk-asert opened a pull request:

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

    GROOVY-8514: NullPointerException in class MissingMethodException

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/paulk-asert/groovy groovy8514

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/groovy/pull/675.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #675
    
----
commit efede2ab04d641bfc8ed8e77d15df3ae87dfc672
Author: paulk <pa...@...>
Date:   2018-03-19T12:46:07Z

    GROOVY-8514: NullPointerException in class MissingMethodException

----


---

[GitHub] groovy pull request #675: GROOVY-8514: NullPointerException in class Missing...

Posted by danielsun1106 <gi...@git.apache.org>.
Github user danielsun1106 commented on a diff in the pull request:

    https://github.com/apache/groovy/pull/675#discussion_r175422491
  
    --- Diff: subprojects/groovy-jsr223/src/main/java/org/codehaus/groovy/jsr223/GroovyScriptEngineImpl.java ---
    @@ -367,6 +367,22 @@ private Object invokeImpl(Object thiz, String name, Object... args)
             }
         }
     
    +    private Object invokeImplSafe(Object thiz, String name, Object... args) {
    +        if (name == null) {
    +            throw new NullPointerException("method name is null");
    --- End diff --
    
    IllegalArgumentException seems better?


---

[GitHub] groovy pull request #675: GROOVY-8514: NullPointerException in class Missing...

Posted by danielsun1106 <gi...@git.apache.org>.
Github user danielsun1106 commented on a diff in the pull request:

    https://github.com/apache/groovy/pull/675#discussion_r175424466
  
    --- Diff: src/main/groovy/groovy/lang/MissingMethodException.java ---
    @@ -48,7 +48,7 @@ public MissingMethodException(String method, Class type, Object[] arguments, boo
             this.method = method;
             this.type = type;
             this.isStatic = isStatic;
    -        this.arguments = arguments;
    +        this.arguments = arguments == null ? new Object[0] : arguments;
    --- End diff --
    
    extract EMPTY_OBJECT_ARRAY to avoid creating object array multiple times?


---

[GitHub] groovy pull request #675: GROOVY-8514: NullPointerException in class Missing...

Posted by paulk-asert <gi...@git.apache.org>.
Github user paulk-asert commented on a diff in the pull request:

    https://github.com/apache/groovy/pull/675#discussion_r176603885
  
    --- Diff: src/main/groovy/groovy/lang/MissingMethodException.java ---
    @@ -48,7 +48,7 @@ public MissingMethodException(String method, Class type, Object[] arguments, boo
             this.method = method;
             this.type = type;
             this.isStatic = isStatic;
    -        this.arguments = arguments;
    +        this.arguments = arguments == null ? new Object[0] : arguments;
    --- End diff --
    
    Done


---

[GitHub] groovy pull request #675: GROOVY-8514: NullPointerException in class Missing...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

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


---

[GitHub] groovy pull request #675: GROOVY-8514: NullPointerException in class Missing...

Posted by paulk-asert <gi...@git.apache.org>.
Github user paulk-asert commented on a diff in the pull request:

    https://github.com/apache/groovy/pull/675#discussion_r176602934
  
    --- Diff: subprojects/groovy-jsr223/src/main/java/org/codehaus/groovy/jsr223/GroovyScriptEngineImpl.java ---
    @@ -367,6 +367,22 @@ private Object invokeImpl(Object thiz, String name, Object... args)
             }
         }
     
    +    private Object invokeImplSafe(Object thiz, String name, Object... args) {
    +        if (name == null) {
    +            throw new NullPointerException("method name is null");
    --- End diff --
    
    I'm replicating the existing functionality, so I won't change that.


---