return JS_FALSE;
if (localv) JS_free(cx, localv); if (error_occurred) return JS_FALSE; else return jsj_ConvertJavaObjectToJSValue(cx, jEnv, java_object, vp);
invoke_java_constructor(JSContext *cx,                        JSJavaThreadState *jsj_env,                        jclass java_class,		        JavaMethodSpec *method,		        jsval *argv, jsval *vp){    jvalue *jargv;    uintN argc, i;    jobject java_object;    jmethodID methodID;    JavaMethodSignature *signature;    JSContext *old_cx;    JNIEnv *jEnv;    JSBool *localv;        methodID = method->methodID;    signature = &method->signature;    argc = signature->num_args;    jEnv = jsj_env->jEnv;    jargv = NULL;    if (argc) {        jargv = convert_JS_method_args_to_java_argv(cx, jEnv, argv, method, &localv);        if (!jargv)            return JS_FALSE;    }    old_cx = JSJ_SetDefaultJSContextForJavaThread(cx, jsj_env);    if (old_cx) {        JS_ReportError(cx, "Java thread in simultaneous use by more than "                           "one JSContext ?");    }    /* Call the constructor */    java_object = (*jEnv)->NewObjectA(jEnv, java_class, methodID, jargv);    JSJ_SetDefaultJSContextForJavaThread(old_cx, jsj_env);    if (!java_object) {        jsj_ReportJavaError(cx, jEnv, "Error while constructing instance of %s",                            jsj_GetJavaClassName(cx, jEnv, java_class));        goto error;    }    for (i = 0; i < argc; i++) {        if (localv[i])            (*jEnv)->DeleteLocalRef(jEnv, jargv[i].l);    }    if (jargv)        JS_free(cx, jargv);    return jsj_ConvertJavaObjectToJSValue(cx, jEnv, java_object, vp);error:    for (i = 0; i < argc; i++) {        if (localv[i])            (*jEnv)->DeleteLocalRef(jEnv, jargv[i].l);    }    if (jargv)       JS_free(cx, jargv);    return JS_FALSE;}