if ((*jEnv)->ExceptionOccurred(jEnv)) { jsj_UnexpectedJavaError(cx, jEnv, "No doubleValue() method for class %s!", class_descriptor->name); return JS_FALSE; }
jsj_ConvertJavaObjectToJSNumber(JSContext *cx, JNIEnv *jEnv,                                JavaClassDescriptor *class_descriptor,                                jobject java_obj, jsval *vp){    jdouble d;    jmethodID doubleValue;    jclass java_class;    java_class = class_descriptor->java_class;    doubleValue = (*jEnv)->GetMethodID(jEnv, java_class, "doubleValue", "()D");    if (!doubleValue) {        /* There is no doubleValue() method for the object.  Try toString()           instead and the JS engine will attempt to convert the result to           a number. */        (*jEnv)->ExceptionClear(jEnv);        return jsj_ConvertJavaObjectToJSString(cx, jEnv, class_descriptor,                                               java_obj, vp);    }    d = (*jEnv)->CallDoubleMethod(jEnv, java_obj, doubleValue);    if ((*jEnv)->ExceptionOccurred(jEnv)) {        jsj_UnexpectedJavaError(cx, jEnv, "doubleValue() method failed");        return JS_FALSE;    }    return JS_NewDoubleValue(cx, d, vp);}