The output of the following snippet:

        public static void main(String[] args) throws Exception {
                printErrorLine("asdf()");
                printErrorLine("java.lang.String.valueOf(111); asdf()");
                printErrorLine("asdf(); java.lang.String.valueOf(111);");
        }

        public static void printErrorLine(String source) {
                Context context = Context.enter();
                context.setOptimizationLevel(-1);
                ImporterTopLevel scope = new ImporterTopLevel(context);
                try {
                        context.evaluateString(scope, source, "<script>", 1, 
null);
                } catch (RhinoException e) {
                        System.out.println("Line: " + e.lineNumber() + ". 
Message: " +
e.getMessage());
                }
        }

is

Line: 1. Message: ReferenceError: "asdf" is not defined. (<script>#1)
Line: 0. Message: ReferenceError: "asdf" is not defined.
Line: 1. Message: ReferenceError: "asdf" is not defined. (<script>#1)

That is, the presence of the "java.lang.String.valueOf(111)" statement
removes line number information from the following ReferenceError. Is
it possible to work around this issue by e.g. configuring the context?

Regards,
Fredrik
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to