Please find patch attached.

[[[
Fix JavaHL error in SVNBase::createCppBoundObject

The problem here is that 'SVNBase::createCppBoundObject' can work
with different classes (see argument), but it cached methodID of
'<init>' for the first class processed.

The error is seen when running JavaHL tests with JDK14.

Error message is:
FATAL ERROR in native method: Wrong object class or methodID passed to JNI call
  at <...>.javahl.util.SubstLib.translateOutputStream(Native Method)
  at <...>.javahl.SVNUtil.translateStream(SVNUtil.java:1046)
  at <...>.javahl.UtilTests.testTranslateStream(UtilTests.java:521)
  <...>

[in subversion/bindings/javahl]
* native/SVNBase.cpp
  (createCppBoundObject): Do not cache methodID.
]]]
Index: subversion/bindings/javahl/native/SVNBase.cpp
===================================================================
--- subversion/bindings/javahl/native/SVNBase.cpp       (revision 1881736)
+++ subversion/bindings/javahl/native/SVNBase.cpp       (working copy)
@@ -107,13 +107,9 @@
   if (JNIUtil::isJavaExceptionThrown())
     return NULL;
 
-  static jmethodID ctor = 0;
-  if (ctor == 0)
-    {
-      ctor = env->GetMethodID(clazz, "<init>", "(J)V");
-      if (JNIUtil::isJavaExceptionThrown())
-        return NULL;
-    }
+  jmethodID ctor = env->GetMethodID(clazz, "<init>", "(J)V");
+  if (JNIUtil::isJavaExceptionThrown())
+    return NULL;
 
   jlong cppAddr = this->getCppAddr();
 

Reply via email to