This fix was contributed by

*      Jason Mawdsley <jason@macadamian.com>
 *      Louis-Philippe Gagnon <louisphilippe@macadamian.com>

It enables webclient to be built and run under JDK1.1.x.  Note that JavaDOM
does not work under jdk1.1.x.

The fix consists of two elements:

On the Java side, replace all JDK1.2 specific calls with JDK1.1.x
equivalents.  On the native side use pre-processer macro for
JNI_VERSION, like this:

#ifdef JNI_VERSION_1_2

#ifndef JNI_VERSION
#define JNI_VERSION JNI_VERSION_1_2
#endif

#else

#ifndef JNI_VERSION_1_1
#define JNI_VERSION_1_1 0x00010001
#endif

#ifndef JNI_VERSION
#define JNI_VERSION JNI_VERSION_1_1
#endif

#endif // END: JNI_VERSION_1_2

This fix has been tested on win32, solaris, and linux.

The following files are in this fix:

M webclient/classes_spec/org/mozilla/webclient/test/DOMTreeModel.java
M webclient/classes_spec/org/mozilla/webclient/test/DOMViewerFrame.java
M webclient/classes_spec/org/mozilla/webclient/test/EMWindow.java
M webclient/classes_spec/org/mozilla/webclient/wrapper_native/BookmarksImpl.java
M webclient/classes_spec/org/mozilla/webclient/wrapper_native/NativeEventThread.java
M webclient/src_moz/CBrowserContainer.cpp
M webclient/src_moz/nsActions.cpp
M webclient/src_share/jni_util.cpp
M webclient/src_share/jni_util.h
M webclient/src_share/jni_util_export.cpp


git-svn-id: svn://10.0.0.236/trunk@79490 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
edburns%acm.org
2000-09-19 00:18:18 +00:00
parent 67dc59a9f1
commit 0898232dc5
10 changed files with 106 additions and 30 deletions

View File

@@ -24,6 +24,8 @@
* Ed Burns <edburns@acm.org>
* Ashutosh Kulkarni <ashuk@eng.sun.com>
* Ann Sunhachawee
* Jason Mawdsley <jason@macadamian.com>
* Louis-Philippe Gagnon <louisphilippe@macadamian.com>
*/
#include "jni_util.h"
@@ -247,7 +249,7 @@ void util_SendEventToJava(JNIEnv *yourEnv, jobject nativeEventThread,
return;
}
JNIEnv *env = (JNIEnv *) JNU_GetEnv(gVm, JNI_VERSION_1_2);
JNIEnv *env = (JNIEnv *) JNU_GetEnv(gVm, JNI_VERSION);
if (nsnull == env) {
return;
@@ -451,7 +453,7 @@ void util_SetIntValueForInstance(JNIEnv *env, jobject obj,
}
env->SetIntField(obj, fieldID, newValue);
#endif;
#endif
}
jobject util_CreatePropertiesObject(JNIEnv *env, jobject initContextObj)
@@ -598,8 +600,13 @@ JNU_CallMethodByNameV(JNIEnv *env,
result.i = 0;
#ifdef JNI_VERSION_1_2
if (env->EnsureLocalCapacity(3) < 0)
goto done2;
#endif
clazz = env->GetObjectClass(obj);
mid = env->GetMethodID(clazz, name, signature);
if (mid == 0)
@@ -643,8 +650,19 @@ JNU_CallMethodByNameV(JNIEnv *env,
env->DeleteLocalRef(clazz);
done2:
if (hasException) {
#ifdef JNI_VERSION_1_2
*hasException = env->ExceptionCheck();
}
#else
jthrowable exception = env->ExceptionOccurred();
if ( exception != NULL ) {
*hasException = true;
env->DeleteLocalRef( exception );
}
else {
*hasException = false;
}
#endif
} // END
return result;
}
@@ -656,7 +674,14 @@ JNU_GetEnv(JavaVM *vm, jint version)
JNIEnv *result = nsnull;
#ifdef BAL_INTERFACE
#else
#ifdef JNI_VERSION_1_2
vm->AttachCurrentThread((void **)&result, (void *) version);
#else
vm->AttachCurrentThread( &result, ( void * )version);
+
#endif
#endif
return result;
}