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

          Activity

          Hide
          jjh James Holmlund (Inactive) added a comment -
          BT2:EVALUATION

          See Description.
          Show
          jjh James Holmlund (Inactive) added a comment - BT2:EVALUATION See Description.
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/dadcfd84d33f
          User: sundar
          Date: 2013-07-11 13:21:41 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/dadcfd84d33f User: sundar Date: 2013-07-11 13:21:41 +0000
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk8/jdk8/jdk/rev/dadcfd84d33f
          User: lana
          Date: 2013-07-23 18:11:27 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk8/jdk8/jdk/rev/dadcfd84d33f User: lana Date: 2013-07-23 18:11:27 +0000

            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: