-
Bug
-
Resolution: Fixed
-
P4
-
6
-
b55
-
x86
-
linux
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"
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"