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

JavaDoc for ScriptEngineFactory.getProgram() contains an error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • 7
    • core-libs
    • b100
    • x86
    • linux
    • Not verified

        A DESCRIPTION OF THE PROBLEM :
        The provided sample implementation of the method getProgram is simply contains syntax error. It is a mix of PHP and Java.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
            public String getProgram(String... statements) {
                int len = 0;
                for (String line : statements) {
                    len += 1 + line.length();
                }
                StringBuilder sb = new StringBuilder(len);
                for( String line : statements){
                    sb.append(line).append("\n");
                }
                return sb.toString();
            }
        ACTUAL -
        public String getProgram(String... statements) {
              $retval = "<?\n";
              int len = statements.length;
              for (int i = 0; i < len; i++) {
                  $retval += statements[i] + ";\n";
              }
              $retval += "?>";

         }

        URL OF FAULTY DOCUMENTATION :
        http://docs.oracle.com/javase/6/docs/api/javax/script/ScriptEngineFactory.html#getProgram%28java.lang.String...%29

              sundar Sundararajan Athijegannathan
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: