*not part of the build*
fix for 15507 15510 git-svn-id: svn://10.0.0.236/trunk@96760 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -85,11 +85,17 @@ void bcJavaStub::Dispatch(bcICall *call) {
|
||||
bcIUnMarshaler * um = call->GetUnMarshaler();
|
||||
mt->UnMarshal(um);
|
||||
jobject jiid = bcIIDJava::GetObject(&iid);
|
||||
jobject retval = bcJavaGlobal::GetJNIEnv()->CallStaticObjectMethod(utilitiesClass, callMethodByIndexMID, object, jiid, (jint)mid, args);
|
||||
//nb return value; excepion handling
|
||||
jobject retval = env->CallStaticObjectMethod(utilitiesClass, callMethodByIndexMID, object, jiid, (jint)mid, args);
|
||||
nsresult result = NS_OK;
|
||||
if (env->ExceptionOccurred()) {
|
||||
env->ExceptionDescribe();
|
||||
result = NS_ERROR_FAILURE;
|
||||
}
|
||||
bcIMarshaler * m = call->GetMarshaler();
|
||||
mt->Marshal(m, retval);
|
||||
//nb memory deallocation
|
||||
m->WriteSimple(&result, bc_T_U32);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
mt->Marshal(m, retval);
|
||||
}
|
||||
delete m; delete um; delete mt;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,9 @@
|
||||
#include "ctype.h"
|
||||
#include "bcJavaGlobal.h"
|
||||
|
||||
|
||||
static jclass XPCOMExceptionClass = NULL;
|
||||
static jmethodID XPCOMExceptionInitMID = NULL;
|
||||
/*
|
||||
* Class: org_mozilla_xpcom_Utilities
|
||||
* Method: callMethodByIndex
|
||||
@@ -68,8 +71,29 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_xpcom_Utilities_callMethodByIndex
|
||||
mt->Marshal(m);
|
||||
orb->SendReceive(call);
|
||||
bcIUnMarshaler * um = call->GetUnMarshaler();
|
||||
nsresult result;
|
||||
jobject retval;
|
||||
mt->UnMarshal(um, &retval);
|
||||
um->ReadSimple(&result, bc_T_U32);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
mt->UnMarshal(um, &retval);
|
||||
} else {
|
||||
if (XPCOMExceptionClass == NULL) {
|
||||
XPCOMExceptionClass = (jclass) env->FindClass("org/mozilla/xpcom/XPCOMException");
|
||||
if (!env->ExceptionOccurred()) { // if there is an exception it will be catched in java
|
||||
XPCOMExceptionClass = (jclass)env->NewGlobalRef(XPCOMExceptionClass);
|
||||
if (!env->ExceptionOccurred()) {
|
||||
XPCOMExceptionInitMID = env->GetMethodID(XPCOMExceptionClass,"<init>","(I)V");
|
||||
if (env->ExceptionOccurred()) {
|
||||
XPCOMExceptionClass = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!env->ExceptionOccurred()) {
|
||||
jthrowable exception = (jthrowable) env->NewObject(XPCOMExceptionClass, XPCOMExceptionInitMID,(jint)result);
|
||||
env->Throw(exception);
|
||||
}
|
||||
}
|
||||
delete call; delete m; delete um; delete mt;
|
||||
|
||||
return retval;
|
||||
|
||||
Reference in New Issue
Block a user