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

JavaDoc for ScriptEngineFactory.getMethodCallSyntax contains an error.

    Details

    • Subcomponent:
    • Resolved In Build:
      b132
    • CPU:
      x86
    • OS:
      windows_xp
    • Verification:
      Verified

      Description

      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

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: