You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by mt...@apache.org on 2007/03/31 07:51:18 UTC

svn commit: r524374 - /tomcat/connectors/trunk/jni/native/src/jnilib.c

Author: mturk
Date: Fri Mar 30 22:51:18 2007
New Revision: 524374

URL: http://svn.apache.org/viewvc?view=rev&rev=524374
Log:
Check for APR version on library load in case we have unsupported APR in the path

Modified:
    tomcat/connectors/trunk/jni/native/src/jnilib.c

Modified: tomcat/connectors/trunk/jni/native/src/jnilib.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jni/native/src/jnilib.c?view=diff&rev=524374&r1=524373&r2=524374
==============================================================================
--- tomcat/connectors/trunk/jni/native/src/jnilib.c (original)
+++ tomcat/connectors/trunk/jni/native/src/jnilib.c Fri Mar 30 22:51:18 2007
@@ -49,12 +49,26 @@
 JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
 {
     JNIEnv *env;
+    apr_version_t apv;
+    int apvn;
 
     UNREFERENCED(reserved);
     if ((*vm)->GetEnv(vm, (void **)&env, JNI_VERSION_1_4)) {
         return JNI_ERR;
     }
     tcn_global_vm = vm;
+
+    /* Before doing anything else check if we have a valid
+     * APR version. We need version 1.2.1 as minimum.
+     */
+    apr_version(&apv);
+    apvn = apv.major * 1000 + apv.minor * 100 + apv.patch;
+    if (apvn < 1201) {
+        tcn_Throw(env, "Unupported APR version (%s)",
+                  apr_version_string());
+        return JNI_ERR;
+    }
+
 
     /* Initialize global java.lang.String class */
     TCN_LOAD_CLASS(env, jString_class, "java/lang/String", JNI_ERR);



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org