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

can't find a ScriptEngine for "JavaScript"

    Details

    • Subcomponent:
    • Introduced In Version:
      6
    • Resolved In Build:
      b55
    • CPU:
      x86
    • OS:
      linux

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0-ea"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-ea-b45)
      Java HotSpot(TM) Client VM (build 1.6.0-ea-b45, mixed mode, sharing)


      ADDITIONAL OS VERSION INFORMATION :
      any, I think

      A DESCRIPTION OF THE PROBLEM :
      (There isn't a subcategory for javax.script, so I just chose one at random. Sorry.)

      The JavaScript interpreter bundled with Mustang only responds to the names "js" and "rhino". This seems like a mistake. It is a JavaScript interpreter and should be selected for names "JavaScript", "javascript", "ECMAScript", and "ecmascript". Also, ScriptEngineManager.getEngineByMimeType() should respond to the official mime t ypes like "application/javascript" and the informal ones like "text/javascript". There is an RFC about these now, so the official list can correctly be supported.

      The problem lies in com.sun.script.javascript.RhinoScriptEngineFactory



      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.script.*;

      public class Hello {
          public static void main(String[] args) {
      ScriptEngineManager sem = new ScriptEngineManager();
      ScriptEngine js = sem.getEngineByExtension("js");

      ScriptEngineFactory factory = js.getFactory();
      System.out.println(factory.getNames());
      System.out.println(factory.getExtensions());
      System.out.println(factory.getMimeTypes());


      try {
      Object result = js.eval(args[0]);
      System.out.println(result.getClass().getName() + ": " + result);
      }
      catch(ScriptException ex) {
      System.out.println(ex);
      }
          }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Use the name "js"

        Attachments

          Activity

            People

            • Assignee:
              sundar Sundararajan Athijegannathan
              Reporter:
              jssunw Jitender S (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: