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

Error on XML literals should be thrown on parsing

    XMLWordPrintable

Details

    • b63
    • generic
    • generic

    Description

      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.

      Attachments

        Activity

          People

            sundar Sundararajan Athijegannathan
            sundar Sundararajan Athijegannathan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: