Github user dkuppitz commented on a diff in the pull request:

    https://github.com/apache/tinkerpop/pull/753#discussion_r153933994
  
    --- Diff: 
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/JavaTranslator.java
 ---
    @@ -173,6 +173,12 @@ private Object invokeMethod(final Object delegate, 
final Class returnType, final
             for (int i = 0; i < arguments.length; i++) {
                 argumentsCopy[i] = translateObject(arguments[i]);
             }
    +
    +        // without this initial check iterating an invalid methodName will 
lead to a null pointer and a less than
    +        // great error message for the user. 
    +        if (!methodCache.containsKey(methodName))
    +            throw new IllegalStateException("Could not locate method: " + 
delegate.getClass().getSimpleName() + "." + methodName + "(" + 
Arrays.toString(argumentsCopy) + ")");
    --- End diff --
    
    Maybe I'm a bit too nit-picky here, but I think the empty square brackets 
(in case of no args) could confuse some people. I would prefer:
    
    ```
    final String methodArgs = argumentsCopy.length() > 0 ? 
Arrays.toString(argumentsCopy) : "";
    throw new IllegalStateException("Could not locate method: " + 
delegate.getClass().getSimpleName() +
            "." + methodName + "(" + methodArgs + ")");
    ```
    
    Besides that, VOTE: +1


---

Reply via email to