Java 类org.mozilla.javascript.tools.ToolErrorReporter 实例源码

项目:https-github.com-hyb1996-NoRootScriptDroid    文件:Main.java   
/**
 * 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);
    String[] args = processOptions(origArgs);
    if (exitCode > 0) {
        return exitCode;
    }
    if (processStdin) {
        fileList.add(null);
    }
    if (true) {
        global.init(shellContextFactory);
    }
    IProxy iproxy = new IProxy(IProxy.PROCESS_FILES);
    iproxy.args = args;
    shellContextFactory.call(iproxy);

    return exitCode;
}
项目:https-github.com-hyb1996-NoRootScriptDroid    文件:Main.java   
static void evalInlineScript(Context cx, String scriptText) {
    try {
        Script script = cx.compileString(scriptText, "<command>", 1, null);
        if (script != null) {
            script.exec(cx, getShellScope());
        }
    } catch (RhinoException rex) {
        ToolErrorReporter.reportException(
                cx.getErrorReporter(), rex);
        exitCode = EXITCODE_RUNTIME_ERROR;
    } catch (VirtualMachineError ex) {
        // Treat StackOverflow and OutOfMemory as runtime errors
        ex.printStackTrace();
        String msg = ToolErrorReporter.getMessage(
                "msg.uncaughtJSException", ex.toString());
        Context.reportError(msg);
        exitCode = EXITCODE_RUNTIME_ERROR;
    }
}
项目:https-github.com-hyb1996-NoRootScriptDroid    文件:Main.java   
public static void processFileNoThrow(Context cx, Scriptable scope, String filename) {
    try {
        processFile(cx, scope, filename);
    } catch (IOException ioex) {
        Context.reportError(ToolErrorReporter.getMessage(
                "msg.couldnt.read.source", filename, ioex.getMessage()));
        exitCode = EXITCODE_FILE_NOT_FOUND;
    } catch (RhinoException rex) {
        ToolErrorReporter.reportException(
                cx.getErrorReporter(), rex);
        exitCode = EXITCODE_RUNTIME_ERROR;
    } catch (VirtualMachineError ex) {
        // Treat StackOverflow and OutOfMemory as runtime errors
        ex.printStackTrace();
        String msg = ToolErrorReporter.getMessage(
                "msg.uncaughtJSException", ex.toString());
        Context.reportError(msg);
        exitCode = EXITCODE_RUNTIME_ERROR;
    }
}
项目:Auto.js    文件:Main.java   
/**
 * 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);
    String[] args = processOptions(origArgs);
    if (exitCode > 0) {
        return exitCode;
    }
    if (processStdin) {
        fileList.add(null);
    }
    if (true) {
        global.init(shellContextFactory);
    }
    IProxy iproxy = new IProxy(IProxy.PROCESS_FILES);
    iproxy.args = args;
    shellContextFactory.call(iproxy);

    return exitCode;
}
项目:Auto.js    文件:Main.java   
static void evalInlineScript(Context cx, String scriptText) {
    try {
        Script script = cx.compileString(scriptText, "<command>", 1, null);
        if (script != null) {
            script.exec(cx, getShellScope());
        }
    } catch (RhinoException rex) {
        ToolErrorReporter.reportException(
                cx.getErrorReporter(), rex);
        exitCode = EXITCODE_RUNTIME_ERROR;
    } catch (VirtualMachineError ex) {
        // Treat StackOverflow and OutOfMemory as runtime errors
        ex.printStackTrace();
        String msg = ToolErrorReporter.getMessage(
                "msg.uncaughtJSException", ex.toString());
        Context.reportError(msg);
        exitCode = EXITCODE_RUNTIME_ERROR;
    }
}
项目:Auto.js    文件:Main.java   
public static void processFileNoThrow(Context cx, Scriptable scope, String filename) {
    try {
        processFile(cx, scope, filename);
    } catch (IOException ioex) {
        Context.reportError(ToolErrorReporter.getMessage(
                "msg.couldnt.read.source", filename, ioex.getMessage()));
        exitCode = EXITCODE_FILE_NOT_FOUND;
    } catch (RhinoException rex) {
        ToolErrorReporter.reportException(
                cx.getErrorReporter(), rex);
        exitCode = EXITCODE_RUNTIME_ERROR;
    } catch (VirtualMachineError ex) {
        // Treat StackOverflow and OutOfMemory as runtime errors
        ex.printStackTrace();
        String msg = ToolErrorReporter.getMessage(
                "msg.uncaughtJSException", ex.toString());
        Context.reportError(msg);
        exitCode = EXITCODE_RUNTIME_ERROR;
    }
}
项目:whackpad    文件:Main.java   
/**
 *  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);
    String[] args = processOptions(origArgs);
    if (mainModule != null && !fileList.contains(mainModule))
        fileList.add(mainModule);
    if (processStdin)
        fileList.add(null);

    if (!global.initialized) {
        global.init(shellContextFactory);
    }
    IProxy iproxy = new IProxy(IProxy.PROCESS_FILES);
    iproxy.args = args;
    shellContextFactory.call(iproxy);

    return exitCode;
}
项目:whackpad    文件:Main.java   
public static Script loadScriptFromSource(Context cx, String scriptSource,
                                          String path, int lineno,
                                          Object securityDomain)
{
    try {
        return cx.compileString(scriptSource, path, lineno,
                                securityDomain);
    } catch (EvaluatorException ee) {
        // Already printed message.
        exitCode = EXITCODE_RUNTIME_ERROR;
    } catch (RhinoException rex) {
        ToolErrorReporter.reportException(
            cx.getErrorReporter(), rex);
        exitCode = EXITCODE_RUNTIME_ERROR;
    } catch (VirtualMachineError ex) {
        // Treat StackOverflow and OutOfMemory as runtime errors
        ex.printStackTrace();
        String msg = ToolErrorReporter.getMessage(
            "msg.uncaughtJSException", ex.toString());
        exitCode = EXITCODE_RUNTIME_ERROR;
        Context.reportError(msg);
    }
    return null;
}
项目:whackpad    文件:Main.java   
public static Object evaluateScript(Script script, Context cx,
                                    Scriptable scope)
{
    try {
        return script.exec(cx, scope);
    } catch (RhinoException rex) {
        ToolErrorReporter.reportException(
            cx.getErrorReporter(), rex);
        exitCode = EXITCODE_RUNTIME_ERROR;
    } catch (VirtualMachineError ex) {
        // Treat StackOverflow and OutOfMemory as runtime errors
        ex.printStackTrace();
        String msg = ToolErrorReporter.getMessage(
            "msg.uncaughtJSException", ex.toString());
        exitCode = EXITCODE_RUNTIME_ERROR;
        Context.reportError(msg);
    }
    return Context.getUndefinedValue();
}
项目:code404    文件:Main.java   
/**
 *  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);
    String[] args = processOptions(origArgs);
    if (processStdin) {
        fileList.add(null);
    }
    if (!global.initialized) {
        global.init(shellContextFactory);
    }
    IProxy iproxy = new IProxy(IProxy.PROCESS_FILES);
    iproxy.args = args;
    shellContextFactory.call(iproxy);

    return exitCode;
}
项目:code404    文件:Main.java   
static void evalInlineScript(Context cx, String scriptText) {
    try {
        Script script = cx.compileString(scriptText, "<command>", 1, null);
        if (script != null) {
            script.exec(cx, getShellScope());
        }
    } catch (RhinoException rex) {
        ToolErrorReporter.reportException(
                cx.getErrorReporter(), rex);
        exitCode = EXITCODE_RUNTIME_ERROR;
    } catch (VirtualMachineError ex) {
        // Treat StackOverflow and OutOfMemory as runtime errors
        ex.printStackTrace();
        String msg = ToolErrorReporter.getMessage(
                "msg.uncaughtJSException", ex.toString());
        Context.reportError(msg);
        exitCode = EXITCODE_RUNTIME_ERROR;
    }
}
项目:code404    文件:Main.java   
public static void processFileNoThrow(Context cx, Scriptable scope, String filename) {
    try {
        processFile(cx, scope, filename);
    } catch (IOException ioex) {
        Context.reportError(ToolErrorReporter.getMessage(
                "msg.couldnt.read.source", filename, ioex.getMessage()));
        exitCode = EXITCODE_FILE_NOT_FOUND;
    } catch (RhinoException rex) {
        ToolErrorReporter.reportException(
                cx.getErrorReporter(), rex);
        exitCode = EXITCODE_RUNTIME_ERROR;
    } catch (VirtualMachineError ex) {
        // Treat StackOverflow and OutOfMemory as runtime errors
        ex.printStackTrace();
        String msg = ToolErrorReporter.getMessage(
                "msg.uncaughtJSException", ex.toString());
        Context.reportError(msg);
        exitCode = EXITCODE_RUNTIME_ERROR;
    }
}
项目:S3F    文件:Main.java   
/**
 *  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);
    String[] args = processOptions(origArgs);
    if (processStdin) {
        fileList.add(null);
    }
    if (!global.initialized) {
        global.init(shellContextFactory);
    }
    IProxy iproxy = new IProxy(IProxy.PROCESS_FILES);
    iproxy.args = args;
    shellContextFactory.call(iproxy);

    return exitCode;
}
项目:S3F    文件:Main.java   
static void evalInlineScript(Context cx, String scriptText) {
    try {
        Script script = cx.compileString(scriptText, "<command>", 1, null);
        if (script != null) {
            script.exec(cx, getShellScope());
        }
    } catch (RhinoException rex) {
        ToolErrorReporter.reportException(
                cx.getErrorReporter(), rex);
        exitCode = EXITCODE_RUNTIME_ERROR;
    } catch (VirtualMachineError ex) {
        // Treat StackOverflow and OutOfMemory as runtime errors
        ex.printStackTrace();
        String msg = ToolErrorReporter.getMessage(
                "msg.uncaughtJSException", ex.toString());
        Context.reportError(msg);
        exitCode = EXITCODE_RUNTIME_ERROR;
    }
}
项目:S3F    文件:Main.java   
public static void processFileNoThrow(Context cx, Scriptable scope, String filename) {
    try {
        processFile(cx, scope, filename);
    } catch (IOException ioex) {
        Context.reportError(ToolErrorReporter.getMessage(
                "msg.couldnt.read.source", filename, ioex.getMessage()));
        exitCode = EXITCODE_FILE_NOT_FOUND;
    } catch (RhinoException rex) {
        ToolErrorReporter.reportException(
                cx.getErrorReporter(), rex);
        exitCode = EXITCODE_RUNTIME_ERROR;
    } catch (VirtualMachineError ex) {
        // Treat StackOverflow and OutOfMemory as runtime errors
        ex.printStackTrace();
        String msg = ToolErrorReporter.getMessage(
                "msg.uncaughtJSException", ex.toString());
        Context.reportError(msg);
        exitCode = EXITCODE_RUNTIME_ERROR;
    }
}
项目:rhino-jscover    文件:Main.java   
/**
 *  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);
    String[] args = processOptions(origArgs);
    if (processStdin) {
        fileList.add(null);
    }
    if (!global.initialized) {
        global.init(shellContextFactory);
    }
    IProxy iproxy = new IProxy(IProxy.PROCESS_FILES);
    iproxy.args = args;
    shellContextFactory.call(iproxy);

    return exitCode;
}
项目:rhino-jscover    文件:Main.java   
static void evalInlineScript(Context cx, String scriptText) {
    try {
        Script script = cx.compileString(scriptText, "<command>", 1, null);
        if (script != null) {
            script.exec(cx, getShellScope());
        }
    } catch (RhinoException rex) {
        ToolErrorReporter.reportException(
                cx.getErrorReporter(), rex);
        exitCode = EXITCODE_RUNTIME_ERROR;
    } catch (VirtualMachineError ex) {
        // Treat StackOverflow and OutOfMemory as runtime errors
        ex.printStackTrace();
        String msg = ToolErrorReporter.getMessage(
                "msg.uncaughtJSException", ex.toString());
        Context.reportError(msg);
        exitCode = EXITCODE_RUNTIME_ERROR;
    }
}
项目:rhino-jscover    文件:Main.java   
public static void processFileNoThrow(Context cx, Scriptable scope, String filename) {
    try {
        processFile(cx, scope, filename);
    } catch (IOException ioex) {
        Context.reportError(ToolErrorReporter.getMessage(
                "msg.couldnt.read.source", filename, ioex.getMessage()));
        exitCode = EXITCODE_FILE_NOT_FOUND;
    } catch (RhinoException rex) {
        ToolErrorReporter.reportException(
                cx.getErrorReporter(), rex);
        exitCode = EXITCODE_RUNTIME_ERROR;
    } catch (VirtualMachineError ex) {
        // Treat StackOverflow and OutOfMemory as runtime errors
        ex.printStackTrace();
        String msg = ToolErrorReporter.getMessage(
                "msg.uncaughtJSException", ex.toString());
        Context.reportError(msg);
        exitCode = EXITCODE_RUNTIME_ERROR;
    }
}
项目:astor    文件:Main.java   
/**
 *  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);
    String[] args = processOptions(origArgs);
    if (processStdin) {
        fileList.add(null);
    }
    if (!global.initialized) {
        global.init(shellContextFactory);
    }
    IProxy iproxy = new IProxy(IProxy.PROCESS_FILES);
    iproxy.args = args;
    shellContextFactory.call(iproxy);

    return exitCode;
}
项目:astor    文件:Main.java   
static void evalInlineScript(Context cx, String scriptText) {
    try {
        Script script = cx.compileString(scriptText, "<command>", 1, null);
        if (script != null) {
            script.exec(cx, getShellScope());
        }
    } catch (RhinoException rex) {
        ToolErrorReporter.reportException(
                cx.getErrorReporter(), rex);
        exitCode = EXITCODE_RUNTIME_ERROR;
    } catch (VirtualMachineError ex) {
        // Treat StackOverflow and OutOfMemory as runtime errors
        ex.printStackTrace();
        String msg = ToolErrorReporter.getMessage(
                "msg.uncaughtJSException", ex.toString());
        Context.reportError(msg);
        exitCode = EXITCODE_RUNTIME_ERROR;
    }
}
项目:astor    文件:Main.java   
public static void processFileNoThrow(Context cx, Scriptable scope, String filename) {
    try {
        processFile(cx, scope, filename);
    } catch (IOException ioex) {
        Context.reportError(ToolErrorReporter.getMessage(
                "msg.couldnt.read.source", filename, ioex.getMessage()));
        exitCode = EXITCODE_FILE_NOT_FOUND;
    } catch (RhinoException rex) {
        ToolErrorReporter.reportException(
                cx.getErrorReporter(), rex);
        exitCode = EXITCODE_RUNTIME_ERROR;
    } catch (VirtualMachineError ex) {
        // Treat StackOverflow and OutOfMemory as runtime errors
        ex.printStackTrace();
        String msg = ToolErrorReporter.getMessage(
                "msg.uncaughtJSException", ex.toString());
        Context.reportError(msg);
        exitCode = EXITCODE_RUNTIME_ERROR;
    }
}
项目:Rhino-Prov-Mod    文件:Main.java   
/**
 *  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);
    String[] args = processOptions(origArgs);
    if (processStdin) {
        fileList.add(null);
    }
    if (!global.initialized) {
        global.init(shellContextFactory);
    }
    IProxy iproxy = new IProxy(IProxy.PROCESS_FILES);
    iproxy.args = args;
    shellContextFactory.call(iproxy);

    return exitCode;
}
项目:Rhino-Prov-Mod    文件:Main.java   
static void evalInlineScript(Context cx, String scriptText) {
    try {
        Script script = cx.compileString(scriptText, "<command>", 1, null);
        if (script != null) {
            script.exec(cx, getShellScope());
        }
    } catch (RhinoException rex) {
        ToolErrorReporter.reportException(
                cx.getErrorReporter(), rex);
        exitCode = EXITCODE_RUNTIME_ERROR;
    } catch (VirtualMachineError ex) {
        // Treat StackOverflow and OutOfMemory as runtime errors
        ex.printStackTrace();
        String msg = ToolErrorReporter.getMessage(
                "msg.uncaughtJSException", ex.toString());
        Context.reportError(msg);
        exitCode = EXITCODE_RUNTIME_ERROR;
    }
}
项目:Rhino-Prov-Mod    文件:Main.java   
public static void processFileNoThrow(Context cx, Scriptable scope, String filename) {
    try {
        processFile(cx, scope, filename);
    } catch (IOException ioex) {
        Context.reportError(ToolErrorReporter.getMessage(
                "msg.couldnt.read.source", filename, ioex.getMessage()));
        exitCode = EXITCODE_FILE_NOT_FOUND;
    } catch (RhinoException rex) {
        ToolErrorReporter.reportException(
                cx.getErrorReporter(), rex);
        exitCode = EXITCODE_RUNTIME_ERROR;
    } catch (VirtualMachineError ex) {
        // Treat StackOverflow and OutOfMemory as runtime errors
        ex.printStackTrace();
        String msg = ToolErrorReporter.getMessage(
                "msg.uncaughtJSException", ex.toString());
        Context.reportError(msg);
        exitCode = EXITCODE_RUNTIME_ERROR;
    }
}
项目:closure-compiler-old    文件:Main.java   
/**
 *  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);
    String[] args = processOptions(origArgs);
    if (processStdin) {
        fileList.add(null);
    }
    if (!global.initialized) {
        global.init(shellContextFactory);
    }
    IProxy iproxy = new IProxy(IProxy.PROCESS_FILES);
    iproxy.args = args;
    shellContextFactory.call(iproxy);

    return exitCode;
}
项目:closure-compiler-old    文件:Main.java   
static void evalInlineScript(Context cx, String scriptText) {
    try {
        Script script = cx.compileString(scriptText, "<command>", 1, null);
        if (script != null) {
            script.exec(cx, getShellScope());
        }
    } catch (RhinoException rex) {
        ToolErrorReporter.reportException(
                cx.getErrorReporter(), rex);
        exitCode = EXITCODE_RUNTIME_ERROR;
    } catch (VirtualMachineError ex) {
        // Treat StackOverflow and OutOfMemory as runtime errors
        ex.printStackTrace();
        String msg = ToolErrorReporter.getMessage(
                "msg.uncaughtJSException", ex.toString());
        Context.reportError(msg);
        exitCode = EXITCODE_RUNTIME_ERROR;
    }
}
项目:closure-compiler-old    文件:Main.java   
public static void processFileNoThrow(Context cx, Scriptable scope, String filename) {
    try {
        processFile(cx, scope, filename);
    } catch (IOException ioex) {
        Context.reportError(ToolErrorReporter.getMessage(
                "msg.couldnt.read.source", filename, ioex.getMessage()));
        exitCode = EXITCODE_FILE_NOT_FOUND;
    } catch (RhinoException rex) {
        ToolErrorReporter.reportException(
                cx.getErrorReporter(), rex);
        exitCode = EXITCODE_RUNTIME_ERROR;
    } catch (VirtualMachineError ex) {
        // Treat StackOverflow and OutOfMemory as runtime errors
        ex.printStackTrace();
        String msg = ToolErrorReporter.getMessage(
                "msg.uncaughtJSException", ex.toString());
        Context.reportError(msg);
        exitCode = EXITCODE_RUNTIME_ERROR;
    }
}
项目:TerraJ    文件:ShellMain.java   
/**
 *  Execute the given arguments, but don't System.exit at the end.
 */
public static int exec(String[] origArgs)
{
    setErrorReporter(new ToolErrorReporter(false, GLOBAL.getErr()));
    shellContextFactory.setErrorReporter(getErrorReporter());

    final String[] args = processOptions(origArgs);

    if (processStdin)
    {
        getFileList()
            .add(null);
    }

    if (!GLOBAL.isInitialized())
    {
        GLOBAL.init(shellContextFactory);
    }

    final IProxy iproxy = new IProxy(IProxy.PROCESS_FILES);
    iproxy.args = args;
    shellContextFactory.call(iproxy);

    return getExitCode();
}
项目:TerraJ    文件:ShellMain.java   
public static Object evaluateScript(
    Script script, Context cx, Scriptable scope)
{
    try
    {
        return script.exec(cx, scope);
    }
    catch (RhinoException rex)
    {
        ToolErrorReporter.reportException(cx.getErrorReporter(), rex);
        exitCode = EXITCODE_RUNTIME_ERROR;
    }
    catch (VirtualMachineError ex)
    {
        // Treat StackOverflow and OutOfMemory as runtime errors
        ex.printStackTrace();

        final String msg =
            ToolErrorReporter.getMessage(
                "msg.uncaughtJSException", ex.toString());
        exitCode = EXITCODE_RUNTIME_ERROR;
        Context.reportError(msg);
    }

    return Context.getUndefinedValue();
}
项目:closure-compiler-copy    文件:Main.java   
/**
 *  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);
    String[] args = processOptions(origArgs);
    if (processStdin) {
        fileList.add(null);
    }
    if (!global.initialized) {
        global.init(shellContextFactory);
    }
    IProxy iproxy = new IProxy(IProxy.PROCESS_FILES);
    iproxy.args = args;
    shellContextFactory.call(iproxy);

    return exitCode;
}
项目:closure-compiler-copy    文件:Main.java   
static void evalInlineScript(Context cx, String scriptText) {
    try {
        Script script = cx.compileString(scriptText, "<command>", 1, null);
        if (script != null) {
            script.exec(cx, getShellScope());
        }
    } catch (RhinoException rex) {
        ToolErrorReporter.reportException(
                cx.getErrorReporter(), rex);
        exitCode = EXITCODE_RUNTIME_ERROR;
    } catch (VirtualMachineError ex) {
        // Treat StackOverflow and OutOfMemory as runtime errors
        ex.printStackTrace();
        String msg = ToolErrorReporter.getMessage(
                "msg.uncaughtJSException", ex.toString());
        Context.reportError(msg);
        exitCode = EXITCODE_RUNTIME_ERROR;
    }
}
项目:closure-compiler-copy    文件:Main.java   
public static void processFileNoThrow(Context cx, Scriptable scope, String filename) {
    try {
        processFile(cx, scope, filename);
    } catch (IOException ioex) {
        Context.reportError(ToolErrorReporter.getMessage(
                "msg.couldnt.read.source", filename, ioex.getMessage()));
        exitCode = EXITCODE_FILE_NOT_FOUND;
    } catch (RhinoException rex) {
        ToolErrorReporter.reportException(
                cx.getErrorReporter(), rex);
        exitCode = EXITCODE_RUNTIME_ERROR;
    } catch (VirtualMachineError ex) {
        // Treat StackOverflow and OutOfMemory as runtime errors
        ex.printStackTrace();
        String msg = ToolErrorReporter.getMessage(
                "msg.uncaughtJSException", ex.toString());
        Context.reportError(msg);
        exitCode = EXITCODE_RUNTIME_ERROR;
    }
}
项目:https-github.com-hyb1996-NoRootScriptDroid    文件:Main.java   
static void processFiles(Context cx, String[] args) {
    // define "arguments" array in the top-level object:
    // need to allocate new array since newArray requires instances
    // of exactly Object[], not ObjectSubclass[]
    Object[] array = new Object[args.length];
    System.arraycopy(args, 0, array, 0, args.length);
    Scriptable argsObj = cx.newArray(global, array);
    global.defineProperty("arguments", argsObj,
            ScriptableObject.DONTENUM);

    for (String file : fileList) {
        try {
            processSource(cx, file);
        } catch (IOException ioex) {
            Context.reportError(ToolErrorReporter.getMessage(
                    "msg.couldnt.read.source", file, ioex.getMessage()));
            exitCode = EXITCODE_FILE_NOT_FOUND;
        } catch (RhinoException rex) {
            ToolErrorReporter.reportException(
                    cx.getErrorReporter(), rex);
            exitCode = EXITCODE_RUNTIME_ERROR;
        } catch (VirtualMachineError ex) {
            // Treat StackOverflow and OutOfMemory as runtime errors
            ex.printStackTrace();
            String msg = ToolErrorReporter.getMessage(
                    "msg.uncaughtJSException", ex.toString());
            Context.reportError(msg);
            exitCode = EXITCODE_RUNTIME_ERROR;
        }
    }
}
项目:Auto.js    文件:Main.java   
static void processFiles(Context cx, String[] args) {
    // define "arguments" array in the top-level object:
    // need to allocate new array since newArray requires instances
    // of exactly Object[], not ObjectSubclass[]
    Object[] array = new Object[args.length];
    System.arraycopy(args, 0, array, 0, args.length);
    Scriptable argsObj = cx.newArray(global, array);
    global.defineProperty("arguments", argsObj,
            ScriptableObject.DONTENUM);

    for (String file : fileList) {
        try {
            processSource(cx, file);
        } catch (IOException ioex) {
            Context.reportError(ToolErrorReporter.getMessage(
                    "msg.couldnt.read.source", file, ioex.getMessage()));
            exitCode = EXITCODE_FILE_NOT_FOUND;
        } catch (RhinoException rex) {
            ToolErrorReporter.reportException(
                    cx.getErrorReporter(), rex);
            exitCode = EXITCODE_RUNTIME_ERROR;
        } catch (VirtualMachineError ex) {
            // Treat StackOverflow and OutOfMemory as runtime errors
            ex.printStackTrace();
            String msg = ToolErrorReporter.getMessage(
                    "msg.uncaughtJSException", ex.toString());
            Context.reportError(msg);
            exitCode = EXITCODE_RUNTIME_ERROR;
        }
    }
}
项目:whackpad    文件:SwitchGenerator.java   
private EvaluatorException on_same_pair_fail(IdValuePair a, IdValuePair b) {
    int line1 = a.getLineNumber(), line2 = b.getLineNumber();
    if (line2 > line1) { int tmp = line1; line1 = line2; line2 = tmp; }
    String error_text = ToolErrorReporter.getMessage(
        "msg.idswitch.same_string", a.id, new Integer(line2));
    return R.runtimeError(error_text, source_file, line1, null, 0);
}
项目:whackpad    文件:Global.java   
/**
 * Print a help message.
 *
 * This method is defined as a JavaScript function.
 */
public static void help(Context cx, Scriptable thisObj,
                        Object[] args, Function funObj)
{
    PrintStream out = getInstance(funObj).getOut();
    out.println(ToolErrorReporter.getMessage("msg.help"));
}
项目:whackpad    文件:Main.java   
/**
 * Read file or url specified by <tt>path</tt>.
 * @return file or url content as <tt>byte[]</tt> or as <tt>String</tt> if
 * <tt>convertToString</tt> is true.
 */
private static Object readFileOrUrl(String path, boolean convertToString)
{
    try {
        return SourceReader.readFileOrUrl(path, convertToString, 
                shellContextFactory.getCharacterEncoding());
    } catch (IOException ex) {
        Context.reportError(ToolErrorReporter.getMessage(
                "msg.couldnt.read.source", path, ex.getMessage()));
        return null;
    }
}
项目:whackpad    文件:Main.java   
public Main()
{
    reporter = new ToolErrorReporter(true);
    compilerEnv = new CompilerEnvirons();
    compilerEnv.setErrorReporter(reporter);
    compiler = new ClassCompiler(compilerEnv);
}
项目:whackpad    文件:Main.java   
private void addError(String messageId, String arg)
{
    String msg;
    if (arg == null) {
        msg = ToolErrorReporter.getMessage(messageId);
    } else {
        msg = ToolErrorReporter.getMessage(messageId, arg);
    }
    addFormatedError(msg);
}
项目:code404    文件:SwitchGenerator.java   
private EvaluatorException on_same_pair_fail(IdValuePair a, IdValuePair b) {
    int line1 = a.getLineNumber(), line2 = b.getLineNumber();
    if (line2 > line1) { int tmp = line1; line1 = line2; line2 = tmp; }
    String error_text = ToolErrorReporter.getMessage(
        "msg.idswitch.same_string", a.id, new Integer(line2));
    return R.runtimeError(error_text, source_file, line1, null, 0);
}