Examples of ToolErrorReporter


Examples of org.mozilla.javascript.tools.ToolErrorReporter

        ByteArrayOutputStream err = new ByteArrayOutputStream();
        this.setOut(new PrintStream(out));
        this.setErr(new PrintStream(err));
        String resultString = "";
        ErrorReporter savedErrorReporter = cx.getErrorReporter();
        cx.setErrorReporter(new ToolErrorReporter(false, this.getErr()));
        try {
            testCount++;
          Object result = cx.evaluateString(scope, inputString,
                          "doctest input", 1, null);
              if (result != Context.getUndefinedValue() &&
View Full Code Here

Examples of org.mozilla.javascript.tools.ToolErrorReporter

        }
        if (engine.isPolicyEnabled()) {
            cx.setInstructionObserverThreshold(instructionLimit);
            cx.setSecurityController(new PolicySecurityController());
        }
        cx.setErrorReporter(new ToolErrorReporter(true));
        cx.setGeneratingDebug(generatingDebug);
    }
View Full Code Here

Examples of org.mozilla.javascript.tools.ToolErrorReporter

        ModuleScope module = new ModuleScope(moduleName, resource, prototype, worker);
        // put module scope in map right away to make circular dependencies work
        worker.registerModule(resource, module);
        // warnings are disabled in shell - enable warnings for module loading
        ErrorReporter er = cx.getErrorReporter();
        ToolErrorReporter reporter = er instanceof ToolErrorReporter ?
                (ToolErrorReporter) er : null;
        if (reporter != null && !reporter.isReportingWarnings()) {
            try {
                reporter.setIsReportingWarnings(true);
                script.exec(cx, module);
            } finally {
                reporter.setIsReportingWarnings(false);
            }
        } else {
            script.exec(cx, module);
        }
        // Update exports in case module updated module.exports
View Full Code Here

Examples of org.mozilla.javascript.tools.ToolErrorReporter

    private final Object lock0 = new Object();

    public CacheManager(CompilerEnvirons compilerEnv) {
        if (compilerEnv == null) {
            compilerEnv = new CompilerEnvirons();
            compilerEnv.setErrorReporter(new ToolErrorReporter(true));
        }
        this.compiler = new ClassCompiler(compilerEnv);
    }
View Full Code Here

Examples of org.mozilla.javascript.tools.ToolErrorReporter

   */
  private ScriptableObject createContext(final ScriptableObject initialScope) {
    final Context context = getContext();
    context.setOptimizationLevel(-1);
    // TODO redirect errors from System.err to LOG.error()
    context.setErrorReporter(new ToolErrorReporter(false));
    context.setLanguageVersion(Context.VERSION_1_8);
    InputStream script = null;
    final ScriptableObject scriptCommon = (ScriptableObject) context.initStandardObjects(initialScope);
    try {
      script = getClass().getResourceAsStream("commons.js");
View Full Code Here

Examples of org.mozilla.javascript.tools.ToolErrorReporter

  public static <V> V execute(final JsTask<V> task) throws IOException {
    Context context = null;
    try {
      context = Context.enter();
      context.setOptimizationLevel(-1);
      context.setErrorReporter(new ToolErrorReporter(false));
      context.setLanguageVersion(Context.VERSION_1_8);

      Global global = new Global();
      global.init(context);
View Full Code Here

Examples of org.mozilla.javascript.tools.ToolErrorReporter

        ByteArrayOutputStream err = new ByteArrayOutputStream();
        this.setOut(new PrintStream(out));
        this.setErr(new PrintStream(err));
        String resultString = "";
        ErrorReporter savedErrorReporter = cx.getErrorReporter();
        cx.setErrorReporter(new ToolErrorReporter(false, this.getErr()));
        try {
            testCount++;
          Object result = cx.evaluateString(scope, inputString,
                          "doctest input", 1, null);
              if (result != Context.getUndefinedValue() &&
View Full Code Here

Examples of org.mozilla.javascript.tools.ToolErrorReporter

    /**
     *  Execute the given arguments, but don't System.exit at the end.
     */
    public static int exec(String origArgs[])
    {
        errorReporter = new ToolErrorReporter(false, global.getErr());
        shellContextFactory.setErrorReporter(errorReporter);
        shellContextFactory.setLanguageVersion(Context.VERSION_1_8);
        //shellContextFactory.setStrictMode(true);
        //errorReporter.setIsReportingWarnings(true);
        String[] args = processOptions(origArgs);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.