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

JavaDoc for ScriptEngineFactory.getProgram() contains an error

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 7
    • Fix Version/s: 8
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b100
    • CPU:
      x86
    • OS:
      linux
    • Verification:
      Not verified

      Backports

        Description

        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

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: