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

JavaDoc for ScriptEngineFactory.getMethodCallSyntax contains an error.

XMLWordPrintable

    • b132
    • x86
    • windows_xp
    • Verified

      A DESCRIPTION OF THE PROBLEM :
      The doc contains a possible implementation for the call syntax of JavaScript.
      This code is wrong for the case of a zero-length argument array.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      String ret = obj;
            ret += "." + m + "(";
            for (int i = 0; i < args.length; i++) {
                ret += args[i];
                if (i < args.length - 1) {
                    ret += ",";
                }
            }
            ret += ")";
            return ret;
      ACTUAL -
      String ret = obj;
            ret += "." + m + "(";
            for (int i = 0; i < args.length; i++) {
                ret += args[i];
                if (i == args.length - 1) {
                    ret += ")";
                } else {
                    ret += ",";
                }
            }
            return ret;

      URL OF FAULTY DOCUMENTATION :
      http://java.sun.com/javase/6/docs/api/javax/script/ScriptEngineFactory.html

            sundar Sundararajan Athijegannathan
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: