You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by vm...@apache.org on 2012/06/06 14:11:20 UTC
svn commit: r1346842 -
/subversion/trunk/subversion/bindings/javahl/native/JNIStackElement.cpp
Author: vmpn
Date: Wed Jun 6 12:11:19 2012
New Revision: 1346842
URL: http://svn.apache.org/viewvc?rev=1346842&view=rev
Log:
JavaHL: Support logging of the static method calls
[ in subversion/bindings/javahl/native ]
* JNIStackElement.cpp
(JNIStackElement): Add logic to deal with NULL jthis, which happens with
static method calls
Approved by: hwright
Modified:
subversion/trunk/subversion/bindings/javahl/native/JNIStackElement.cpp
Modified: subversion/trunk/subversion/bindings/javahl/native/JNIStackElement.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/JNIStackElement.cpp?rev=1346842&r1=1346841&r2=1346842&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/JNIStackElement.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/JNIStackElement.cpp Wed Jun 6 12:11:19 2012
@@ -58,20 +58,28 @@ JNIStackElement::JNIStackElement(JNIEnv
return;
}
- // This will call java.lang.Object.toString, even when it is
- // overriden.
- jobject oStr = env->CallNonvirtualObjectMethod(jthis, jlo, mid);
- if (JNIUtil::isJavaExceptionThrown())
- return;
-
- // Copy the result to a buffer.
- JNIStringHolder name(reinterpret_cast<jstring>(oStr));
*m_objectID = 0;
- strncat(m_objectID, name, JNIUtil::formatBufferSize -1);
+
+ if(jthis == NULL)
+ {
+ strcpy(m_objectID, "<static>");
+ }
+ else
+ {
+ // This will call java.lang.Object.toString, even when it is
+ // overriden.
+ jobject oStr = env->CallNonvirtualObjectMethod(jthis, jlo, mid);
+ if (JNIUtil::isJavaExceptionThrown())
+ return;
+
+ // Copy the result to a buffer.
+ JNIStringHolder name(reinterpret_cast<jstring>(oStr));
+ strncat(m_objectID, name, JNIUtil::formatBufferSize -1);
+ env->DeleteLocalRef(oStr);
+ }
// Release the Java string.
env->DeleteLocalRef(jlo);
- env->DeleteLocalRef(oStr);
// Remember the parameter for the exit of the method.
m_clazz = clazz;