You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2011/08/04 18:19:48 UTC

svn commit: r1153919 - in /subversion/branches/1.7.x: ./ STATUS subversion/bindings/javahl/native/SVNBase.cpp subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java

Author: hwright
Date: Thu Aug  4 16:19:47 2011
New Revision: 1153919

URL: http://svn.apache.org/viewvc?rev=1153919&view=rev
Log:
Merge r1153799, r1153807 from trunk:

 * r1153799, r1153807
   Fixes a segfault in JavaHL when the dispose() method is used.
   Justification:
     Users are supposed to call dispose, and crashes are bad.
   Votes:
    +1: rhuijben, markphip

Modified:
    subversion/branches/1.7.x/   (props changed)
    subversion/branches/1.7.x/STATUS
    subversion/branches/1.7.x/subversion/bindings/javahl/native/SVNBase.cpp
    subversion/branches/1.7.x/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java

Propchange: subversion/branches/1.7.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug  4 16:19:47 2011
@@ -54,4 +54,4 @@
 /subversion/branches/tree-conflicts:868291-873154
 /subversion/branches/tree-conflicts-notify:873926-874008
 /subversion/branches/uris-as-urls:1060426-1064427
-/subversion/trunk:1146013,1146121,1146219,1146222,1146274,1146492,1146555,1146606,1146620,1146684,1146781,1146832,1146834,1146870,1146899,1146904,1147293,1147309,1147882,1148071,1148131,1148374,1148424,1148566,1148588,1148853,1148877,1148882,1148936,1149105,1149141,1149160,1149228,1149240,1149343,1149371-1149372,1149377,1149398,1149401,1149539,1149572,1149675,1149701,1149713,1150242,1150372,1150441,1150506,1150812,1150853,1151036,1151177,1151610,1151911,1152129,1152282,1152726,1153416
+/subversion/trunk:1146013,1146121,1146219,1146222,1146274,1146492,1146555,1146606,1146620,1146684,1146781,1146832,1146834,1146870,1146899,1146904,1147293,1147309,1147882,1148071,1148131,1148374,1148424,1148566,1148588,1148853,1148877,1148882,1148936,1149105,1149141,1149160,1149228,1149240,1149343,1149371-1149372,1149377,1149398,1149401,1149539,1149572,1149675,1149701,1149713,1150242,1150372,1150441,1150506,1150812,1150853,1151036,1151177,1151610,1151911,1152129,1152282,1152726,1153416,1153799,1153807

Modified: subversion/branches/1.7.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/STATUS?rev=1153919&r1=1153918&r2=1153919&view=diff
==============================================================================
--- subversion/branches/1.7.x/STATUS (original)
+++ subversion/branches/1.7.x/STATUS Thu Aug  4 16:19:47 2011
@@ -215,10 +215,3 @@ Approved changes:
      this revision depends for a clean merge).
    Votes:
      +1: rhuijben, danielsh, cmpilato
-
- * r1153799, r1153807
-   Fixes a segfault in JavaHL when the dispose() method is used.
-   Justification:
-     Users are supposed to call dispose, and crashes are bad.
-   Votes:
-    +1: rhuijben, markphip

Modified: subversion/branches/1.7.x/subversion/bindings/javahl/native/SVNBase.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/bindings/javahl/native/SVNBase.cpp?rev=1153919&r1=1153918&r2=1153919&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/bindings/javahl/native/SVNBase.cpp (original)
+++ subversion/branches/1.7.x/subversion/bindings/javahl/native/SVNBase.cpp Thu Aug  4 16:19:47 2011
@@ -57,14 +57,17 @@ jlong SVNBase::findCppAddrForJObject(job
       if (JNIUtil::isJavaExceptionThrown())
         return 0;
 
-      /* jthis is not guaranteed to be the same between JNI invocations, so
-         we do a little dance here and store the updated version in our
-         object for this invocation.
-
-         findCppAddrForJObject() is, by necessity, called before any other
-         methods on the C++ object, so by doing this we can guarantee a valid
-         jthis pointer for subsequent uses. */
-      (reinterpret_cast<SVNBase *> (cppAddr))->jthis = jthis;
+      if (cppAddr)
+        {
+          /* jthis is not guaranteed to be the same between JNI invocations, so
+             we do a little dance here and store the updated version in our
+             object for this invocation.
+
+             findCppAddrForJObject() is, by necessity, called before any other
+             methods on the C++ object, so by doing this we can guarantee a
+             valid jthis pointer for subsequent uses. */
+          (reinterpret_cast<SVNBase *> (cppAddr))->jthis = jthis;
+        }
       return cppAddr;
     }
 }

Modified: subversion/branches/1.7.x/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java?rev=1153919&r1=1153918&r2=1153919&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java (original)
+++ subversion/branches/1.7.x/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java Thu Aug  4 16:19:47 2011
@@ -3343,6 +3343,16 @@ public class BasicTests extends SVNTests
     }
 
     /**
+     * Test an explicit expose of SVNClient.
+     * (This used to cause a fatal exception in the Java Runtime)
+     */
+    public void testDispose() throws Throwable
+    {
+      SVNClient cl = new SVNClient();
+      cl.dispose();
+    }
+
+    /**
      * @return <code>file</code> converted into a -- possibly
      * <code>canonical</code>-ized -- Subversion-internal path
      * representation.