subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1664939 - /subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp
Date Sun, 08 Mar 2015 01:22:15 GMT
Author: rhuijben
Date: Sun Mar  8 01:22:15 2015
New Revision: 1664939

URL: http://svn.apache.org/r1664939
Log:
Following up on r1664938, add some debug code to make 'Java error leaks'
visible in maintainer/test mode.

* subversion/bindings/javahl/native/JNIUtil.cpp
  (WrappedException): Track whether the exception is fetched. Use DBG output
    if it isn't.

Modified:
    subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp

Modified: subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp?rev=1664939&r1=1664938&r2=1664939&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp Sun Mar  8 01:22:15 2015
@@ -1079,6 +1079,9 @@ class WrappedException
 {
   JNIEnv *m_env;
   jthrowable m_exception;
+#ifdef SVN_DEBUG
+  bool m_fetched;
+#endif
 public:
   WrappedException(JNIEnv *env)
   {
@@ -1092,6 +1095,8 @@ public:
 
     // As adding a reference in exception state fails
     m_exception = static_cast<jthrowable>(env->NewGlobalRef(exceptionObj));
+
+    m_fetched = false;
   }
 
   static jthrowable get_exception(apr_pool_t *pool)
@@ -1103,6 +1108,9 @@ public:
 
           if (we)
           {
+#ifdef SVN_DEBUG
+              we->m_fetched = TRUE;
+#endif
               // Create reference in local frame, as the pool will be cleared
               return static_cast<jthrowable>(
                             we->m_env->NewLocalRef(we->m_exception));
@@ -1114,6 +1122,10 @@ public:
 private:
   ~WrappedException()
   {
+#ifdef SVN_DEBUG
+      if (!m_fetched)
+          SVN_DBG(("Cleared svn_error_t * before Java exception was fetched"));
+#endif
       m_env->DeleteGlobalRef(m_exception);
   }
 public:



Mime
View raw message