示例#1
0
void rvmRaiseException(Env* env, Object* e) {
    if (env->throwable != e) {
        rvmThrow(env, e);
    }
    jboolean (*exceptionMatch)(Env*, TrycatchContext*) = env->vm->options->exceptionMatch;
    TrycatchContext* tc = env->trycatchContext;
    while (tc) {
        if (tc->sel != 0 && (tc->sel == CATCH_ALL_SEL || exceptionMatch(env, tc))) {
            rvmRestoreThreadSignalMask(env);
            rvmHookExceptionRaised(env, e, tc->prev? TRUE: FALSE);
            rvmTrycatchJump(tc);
            // unreachable
        }
        rvmTrycatchLeave(env);
        tc = env->trycatchContext;
    }

    /*
     * We only end up here if Java was called into from native without a
     * TrycatchContext being set up first. This only happens for @Callback
     * methods. The only sane thing to do here is to terminate the app. But
     * first we want to detach the current thread which will report the
     * uncaught exception to the uncaught exception handler.
     */
    env->gatewayFrames = NULL; // Needed to avoid the "Cannot detach thread when there are non native frames on the call stack" error
    rvmDetachCurrentThread(env->vm, TRUE, TRUE);
    rvmAbort("Unhandled exception (probably in a @Callback method called from native code): %s", e->clazz->name);
}
示例#2
0
void rvmRaiseException(Env* env, Object* e) {
    if (env->throwable != e) {
        rvmThrow(env, e);
    }
    jboolean (*exceptionMatch)(Env*, TrycatchContext*) = env->vm->options->exceptionMatch;
    TrycatchContext* tc = env->trycatchContext;
    while (tc) {
        if (tc->sel != 0 && (tc->sel == CATCH_ALL_SEL || exceptionMatch(env, tc))) {
            rvmRestoreSignalMask(env);
            rvmTrycatchJump(tc);
            // unreachable
        }
        rvmTrycatchLeave(env);
        tc = env->trycatchContext;
    }
    rvmAbort("Unhandled exception: %s", e->clazz->name);
}