Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8191201

javax.script.ScriptEngineFactory.getMethodCallSyntax() spec should not allow null be passed as an argument

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 10
    • core-libs
    • None
    • behavioral
    • low
    • Throwing NPE more eagerly.
    • Java API
    • SE

      Summary

      Change specification of javax.script.ScriptEngineFactory.getMethodCallSyntax to throw NullPointerException for null arguments.

      Problem

      Class: javax.script.ScriptEngineFactory Method: public String getMethodCallSyntax(String obj, String m, String... args);

      This method does not specify behavior on null arguments (null for obj, null for m, null for args or any of the elements of args).

      Solution

      javadoc comment will be modified to explicitly state that NullPointerException is thrown for any null argument.

      Specification

      
      
      diff -r acfedb75dd51 src/java.scripting/share/classes/javax/script/ScriptEngineFactory.java
      --- a/src/java.scripting/share/classes/javax/script/ScriptEngineFactory.java    Tue Nov 14 08:59:19 2017 +0530
      +++ b/src/java.scripting/share/classes/javax/script/ScriptEngineFactory.java    Tue Nov 14 14:46:12 2017 +0530
      @@ -176,6 +176,8 @@
            * @param args names of the arguments in the method call.
            *
            * @return The String used to invoke the method in the syntax of the scripting language.
      +     *
      +     * @throws NullPointerException if obj or m or args or any of the elements of args is null.
            */
           public String getMethodCallSyntax(String obj, String m, String... args);
      
      
      

            sundar Sundararajan Athijegannathan
            dbessono Dmitry Bessonov
            Jim Laskey
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: