initialized = PR_TRUE;
if (!(clazz = env->FindClass("java/lang/Short")) || !(shortValueMID = env->GetMethodID(clazz,"shortValue","()S"))) { return PR_FALSE;
InitializeJavaGlobals(JNIEnv *env){  static PRBool initialized = PR_FALSE;  if (!initialized)  {    jclass clazz;    if (!(clazz = env->FindClass("java/lang/Class")) ||        !(classClass = (jclass) env->NewGlobalRef(clazz)))    {        return PR_FALSE;    }      if (!(clazz = env->FindClass("java/lang/Object")) ||        !(objectClass = (jclass) env->NewGlobalRef(clazz)))    {        return PR_FALSE;    }      if (!(clazz = env->FindClass("java/lang/Boolean")) ||        !(booleanClass = (jclass) env->NewGlobalRef(clazz)) ||        !(clazz = env->FindClass("[Z")) ||        !(booleanArrayClass = (jclass) env->NewGlobalRef(clazz)))    {        return PR_FALSE;    }      if (!(clazz = env->FindClass("java/lang/Character")) ||        !(charClass = (jclass) env->NewGlobalRef(clazz)) ||        !(clazz = env->FindClass("[C")) ||        !(charArrayClass = (jclass) env->NewGlobalRef(clazz)))    {        return PR_FALSE;    }    if (!(clazz = env->FindClass("java/lang/Byte")) ||        !(byteClass = (jclass) env->NewGlobalRef(clazz)) ||        !(clazz = env->FindClass("[B")) ||        !(byteArrayClass = (jclass) env->NewGlobalRef(clazz)))    {        return PR_FALSE;    }    if (!(clazz = env->FindClass("java/lang/Short")) ||        !(shortClass = (jclass) env->NewGlobalRef(clazz)) ||        !(clazz = env->FindClass("[[S")) ||        !(shortArrayClass = (jclass) env->NewGlobalRef(clazz)))    {        return PR_FALSE;    }    if (!(clazz = env->FindClass("java/lang/Integer")) ||        !(intClass = (jclass) env->NewGlobalRef(clazz)) ||        !(clazz = env->FindClass("[I")) ||        !(intArrayClass = (jclass) env->NewGlobalRef(clazz)))    {        return PR_FALSE;    }    if (!(clazz = env->FindClass("java/lang/Long")) ||        !(longClass = (jclass) env->NewGlobalRef(clazz)) ||        !(clazz = env->FindClass("[J")))    {        return PR_FALSE;    }    if (!(clazz = env->FindClass("java/lang/Float")) ||        !(floatClass = (jclass) env->NewGlobalRef(clazz)) ||        !(clazz = env->FindClass("[F")) ||        !(floatArrayClass = (jclass) env->NewGlobalRef(clazz)))    {        return PR_FALSE;    }    if (!(clazz = env->FindClass("java/lang/Double")) ||        !(doubleClass = (jclass) env->NewGlobalRef(clazz)) ||        !(clazz = env->FindClass("[D")) ||        !(doubleArrayClass = (jclass) env->NewGlobalRef(clazz)))    {        return PR_FALSE;    }      if (!(clazz = env->FindClass("java/lang/String")) ||        !(stringClass = (jclass) env->NewGlobalRef(clazz)) ||        !(clazz = env->FindClass("[Ljava/lang/String;")) ||        !(stringArrayClass = (jclass) env->NewGlobalRef(clazz)))    {        return PR_FALSE;    }      if (!(clazz = env->FindClass("org/mozilla/xpcom/nsISupports")) ||        !(nsISupportsClass = (jclass) env->NewGlobalRef(clazz)))    {        return PR_FALSE;    }    if (!(clazz = env->FindClass("org/mozilla/xpcom/XPCOMException")) ||        !(xpcomExceptionClass = (jclass) env->NewGlobalRef(clazz)))    {        return PR_FALSE;    }    if (!(hashCodeMID = env->GetMethodID(objectClass, "hashCode","()I"))) {        return PR_FALSE;    }      if (!(booleanInitMID = env->GetMethodID(booleanClass,"<init>","(Z)V"))) {        return PR_FALSE;    }    if (!(booleanValueMID = env->GetMethodID(booleanClass,"booleanValue","()Z"))) {        return PR_FALSE;    }      if (!(charInitMID = env->GetMethodID(charClass,"<init>","(C)V"))) {        return PR_FALSE;    }    if (!(charValueMID = env->GetMethodID(charClass,"charValue","()C"))) {        return PR_FALSE;    }      if (!(byteInitMID = env->GetMethodID(byteClass,"<init>","(B)V"))) {        return PR_FALSE;    }    if (!(byteValueMID = env->GetMethodID(byteClass,"byteValue","()B"))) {        return PR_FALSE;    }    if (!(shortInitMID = env->GetMethodID(shortClass,"<init>","(S)V"))) {        return PR_FALSE;    }    if (!(shortValueMID = env->GetMethodID(shortClass,"shortValue","()S"))) {        return PR_FALSE;    }      if (!(intInitMID = env->GetMethodID(intClass,"<init>","(I)V"))) {        return PR_FALSE;    }    if (!(intValueMID = env->GetMethodID(intClass,"intValue","()I"))) {        return PR_FALSE;    }      if (!(longInitMID = env->GetMethodID(longClass,"<init>","(J)V"))) {        return PR_FALSE;    }    if (!(longValueMID = env->GetMethodID(longClass,"longValue","()J"))) {        return PR_FALSE;    }      if (!(floatInitMID = env->GetMethodID(floatClass,"<init>","(F)V"))) {        return PR_FALSE;    }    if (!(floatValueMID = env->GetMethodID(floatClass,"floatValue","()F"))) {        return PR_FALSE;    }      if (!(doubleInitMID = env->GetMethodID(doubleClass,"<init>","(D)V"))) {        return PR_FALSE;    }    if (!(doubleValueMID = env->GetMethodID(doubleClass,"doubleValue","()D"))) {        return PR_FALSE;    }      if (!(getNameMID = env->GetMethodID(classClass, "getName","()Ljava/lang/String;"))) {        return PR_FALSE;    }      static PLDHashTableOps java_to_xpcom_hash_ops =    {      PL_DHashAllocTable,      PL_DHashFreeTable,      PL_DHashGetKeyStub,      PL_DHashVoidPtrKeyStub,      PL_DHashMatchEntryStub,      PL_DHashMoveEntryStub,      PL_DHashClearEntryStub,      PL_DHashFinalizeStub,      InitJavaXPCOMBindingEntry    };      gJAVAtoXPCOMBindings = PL_NewDHashTable(&java_to_xpcom_hash_ops, nsnull,                                            sizeof(JavaXPCOMBindingEntry), 16);    if (!gJAVAtoXPCOMBindings) {      return PR_FALSE;    }      static PLDHashTableOps xpcom_to_java_hash_ops =    {      PL_DHashAllocTable,      PL_DHashFreeTable,      PL_DHashGetKeyStub,      PL_DHashVoidPtrKeyStub,      PL_DHashMatchEntryStub,      PL_DHashMoveEntryStub,      PL_DHashClearEntryStub,      PL_DHashFinalizeStub,      InitJavaXPCOMBindingEntry    };      gXPCOMtoJAVABindings = PL_NewDHashTable(&xpcom_to_java_hash_ops, nsnull,                                            sizeof(JavaXPCOMBindingEntry), 16);    if (!gXPCOMtoJAVABindings) {      return PR_FALSE;    }    initialized = PR_TRUE;  }  return PR_TRUE;}