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

Error on XML literals should be thrown on parsing

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 6
    • Fix Version/s: 6
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b63
    • CPU:
      generic
    • OS:
      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

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

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: