-
Bug
-
Resolution: Fixed
-
P4
-
6
-
b63
-
generic
-
generic
E4X (ECMAScript for XML) is not supported in Mustang. But, error on XML literals should be detected early and reported.
import javax.script.*;
public class t {
public static void main(String[] args) throws Exception {
ScriptEngineManager m = new ScriptEngineManager();
ScriptEngine e = m.getEngineByName("js");
// E4X (XML support for JavaScript) is not supported.
// but we expect a better error message (like 'syntax error')
e.eval("var v = <html></html>");
}
}
The above program throws an exception with the message:
Exception in thread "main" javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "XML" is not defined. (<Unknown source>#1) in <Unknown source> at line number 1
i.e., the error is detected after parsing (while searching for XML constructor). It would be better to report the error while parsing.
import javax.script.*;
public class t {
public static void main(String[] args) throws Exception {
ScriptEngineManager m = new ScriptEngineManager();
ScriptEngine e = m.getEngineByName("js");
// E4X (XML support for JavaScript) is not supported.
// but we expect a better error message (like 'syntax error')
e.eval("var v = <html></html>");
}
}
The above program throws an exception with the message:
Exception in thread "main" javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "XML" is not defined. (<Unknown source>#1) in <Unknown source> at line number 1
i.e., the error is detected after parsing (while searching for XML constructor). It would be better to report the error while parsing.