You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2015/05/05 11:24:28 UTC

svn commit: r1677760 - in /subversion/branches/move-tracking-2: ./ build/ build/ac-macros/ subversion/ subversion/bindings/javahl/ subversion/bindings/javahl/native/ subversion/bindings/javahl/native/jniwrapper/ subversion/bindings/javahl/src/org/apach...

Author: julianfoad
Date: Tue May  5 09:24:27 2015
New Revision: 1677760

URL: http://svn.apache.org/r1677760
Log:
On the 'move-tracking-2' branch: catch up to trunk@1677758.

Modified:
    subversion/branches/move-tracking-2/   (props changed)
    subversion/branches/move-tracking-2/CHANGES   (contents, props changed)
    subversion/branches/move-tracking-2/build/   (props changed)
    subversion/branches/move-tracking-2/build/ac-macros/java.m4
    subversion/branches/move-tracking-2/configure.ac   (contents, props changed)
    subversion/branches/move-tracking-2/subversion/   (props changed)
    subversion/branches/move-tracking-2/subversion/bindings/javahl/README
    subversion/branches/move-tracking-2/subversion/bindings/javahl/native/CreateJ.cpp
    subversion/branches/move-tracking-2/subversion/bindings/javahl/native/EditorProxy.cpp
    subversion/branches/move-tracking-2/subversion/bindings/javahl/native/NativeStream.cpp
    subversion/branches/move-tracking-2/subversion/bindings/javahl/native/NativeStream.hpp
    subversion/branches/move-tracking-2/subversion/bindings/javahl/native/jniwrapper/jni_base.cpp
    subversion/branches/move-tracking-2/subversion/bindings/javahl/native/jniwrapper/jni_globalref.hpp
    subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
    subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
    subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StatusEditor.java
    subversion/branches/move-tracking-2/subversion/include/private/svn_subr_private.h
    subversion/branches/move-tracking-2/subversion/libsvn_client/copy.c
    subversion/branches/move-tracking-2/subversion/libsvn_fs/fs-loader.c
    subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/cached_data.c
    subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/transaction.c
    subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c
    subversion/branches/move-tracking-2/subversion/libsvn_ra_local/ra_plugin.c
    subversion/branches/move-tracking-2/subversion/libsvn_subr/checksum.c
    subversion/branches/move-tracking-2/subversion/libsvn_subr/dso.c
    subversion/branches/move-tracking-2/subversion/libsvn_subr/stream.c
    subversion/branches/move-tracking-2/subversion/tests/libsvn_client/client-test.c
    subversion/branches/move-tracking-2/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c
    subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/checksum-test.c
    subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/io-test.c

Propchange: subversion/branches/move-tracking-2/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue May  5 09:24:27 2015
@@ -52,7 +52,7 @@ serf
 gmock-fused
 .git
 .gitignore
+.idea
 compile_commands.json
 .kdev4
 *.kdev4
-.build.conf.swo

Propchange: subversion/branches/move-tracking-2/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May  5 09:24:27 2015
@@ -88,4 +88,4 @@
 /subversion/branches/verify-at-commit:1462039-1462408
 /subversion/branches/verify-keep-going:1439280-1546110
 /subversion/branches/wc-collate-path:1402685-1480384
-/subversion/trunk:1606692-1676219
+/subversion/trunk:1606692-1677758

Modified: subversion/branches/move-tracking-2/CHANGES
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/CHANGES?rev=1677760&r1=1677759&r2=1677760&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/CHANGES (original)
+++ subversion/branches/move-tracking-2/CHANGES Tue May  5 09:24:27 2015
@@ -717,7 +717,7 @@ http://svn.apache.org/repos/asf/subversi
     * swig-py: fix support for svn_ra_lock() and svn_ra_unlock() (r1662891)
     * javahl: allow java callbacks to throw errors back to the svn code
       (r1664938, r1664939, r1664940, r1664978, r1664984)
-    * swig-pl: fix some statck memory problems (r1668618, 1671388)
+    * swig-pl: fix some stack memory problems (r1668618, 1671388)
 
 
 Version 1.8.13

Propchange: subversion/branches/move-tracking-2/CHANGES
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May  5 09:24:27 2015
@@ -86,4 +86,4 @@
 /subversion/branches/verify-at-commit/CHANGES:1462039-1462408
 /subversion/branches/verify-keep-going/CHANGES:1439280-1546110
 /subversion/branches/wc-collate-path/CHANGES:1402685-1480384
-/subversion/trunk/CHANGES:1606692-1676219
+/subversion/trunk/CHANGES:1606692-1677758

Propchange: subversion/branches/move-tracking-2/build/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May  5 09:24:27 2015
@@ -82,4 +82,4 @@
 /subversion/branches/verify-at-commit/build:1462039-1462408
 /subversion/branches/verify-keep-going/build:1439280-1546110
 /subversion/branches/wc-collate-path/build:1402685-1480384
-/subversion/trunk/build:1606692-1676219
+/subversion/trunk/build:1606692-1677758

Modified: subversion/branches/move-tracking-2/build/ac-macros/java.m4
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/build/ac-macros/java.m4?rev=1677760&r1=1677759&r2=1677760&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/build/ac-macros/java.m4 (original)
+++ subversion/branches/move-tracking-2/build/ac-macros/java.m4 Tue May  5 09:24:27 2015
@@ -151,49 +151,22 @@ AC_DEFUN(SVN_FIND_JDK,
     JAVADOC="$JAVA_BIN/javadoc"
     JAR="$JAVA_BIN/jar"
 
-    dnl Prefer Jikes (for speed) if available.
-    jikes_options="/usr/local/bin/jikes /usr/bin/jikes"
+    dnl Once upon a time we preferred Jikes for speed.
+    dnl Jikes is dead, long live Jikes!
     AC_ARG_WITH(jikes,
                 AS_HELP_STRING([--with-jikes=PATH],
-                               [Specify the path to a jikes binary to use
-                                it as your Java compiler.  The default is to
-                                look for jikes (PATH optional).  This behavior
-                                can be switched off by supplying 'no'.]),
+                   [Deprecated. Provided for backward compatibility.]),
     [
-        if test "$withval" != "no" && test "$withval" != "yes"; then
-          dnl Assume a path was provided.
-          jikes_options="$withval $jikes_options"
-        fi
-        requested_jikes="$withval"  # will be 'yes' if path unspecified
-    ])
-    if test "$requested_jikes" != "no"; then
-      dnl Look for a usable jikes binary.
-      for jikes in $jikes_options; do
-        if test -z "$jikes_found" && test -x "$jikes"; then
-          jikes_found="yes"
-          JAVAC="$jikes"
-          JAVA_CLASSPATH="$JRE_LIB_DIR"
-          for jar in $JRE_LIB_DIR/*.jar; do
-            JAVA_CLASSPATH="$JAVA_CLASSPATH:$jar"
-          done
-        fi
-      done
-    fi
-    if test -n "$requested_jikes" && test "$requested_jikes" != "no"; then
-      dnl Jikes was explicitly requested.  Verify that it was provided.
-      if test -z "$jikes_found"; then
-        AC_MSG_ERROR([Could not find a usable version of Jikes])
-      elif test -n "$jikes_found" && test "$requested_jikes" != "yes" &&
-           test "$JAVAC" != "$requested_jikes"; then
-        AC_MSG_WARN([--with-jikes PATH was invalid, substitute found])
+      if test "$withval" != "no"; then
+        AC_MSG_WARN([The --with-jikes option was ignored])
       fi
-    fi
+    ])
 
     dnl Add javac flags.
     # The release for "-source" could actually be greater than that
     # of "-target", if we want to cross-compile for lesser JVMs.
     if test -z "$JAVAC_FLAGS"; then
-      JAVAC_FLAGS="-target $JAVA_OLDEST_WORKING_VER -source 1.5"
+      JAVAC_FLAGS="-target $JAVA_OLDEST_WORKING_VER -source 1.6"
       if test "$enable_debugging" = "yes"; then
         JAVAC_FLAGS="-g -Xlint -Xlint:unchecked -Xlint:serial -Xlint:path $JAVAC_FLAGS"
         if test -z "$JAVAC_COMPAT_FLAGS"; then

Modified: subversion/branches/move-tracking-2/configure.ac
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/configure.ac?rev=1677760&r1=1677759&r2=1677760&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/configure.ac (original)
+++ subversion/branches/move-tracking-2/configure.ac Tue May  5 09:24:27 2015
@@ -1283,7 +1283,7 @@ fi
 AC_PATH_PROGS(PYTHON, "$PYTHON", none)
 
 # The minimum version for the JVM runtime for our Java bytecode.
-JAVA_OLDEST_WORKING_VER='1.5'
+JAVA_OLDEST_WORKING_VER='1.6'
 # SVN_CHECK_JDK sets $JAVA_CLASSPATH
 SVN_CHECK_JDK($JAVA_OLDEST_WORKING_VER)
 
@@ -1354,6 +1354,19 @@ AS_HELP_STRING([--enable-runtime-module-
       fi
       AC_DEFINE(SVN_USE_DSO, 1,
                 [Defined if svn should try to load DSOs])
+
+      dnl Mac OS X uses libname.MAJOR.SOVERSION.dylib
+      dnl Most other unixes use libname.MAJOR.so.SOVERSION
+      case "$host" in
+        *-*-darwin*)
+          AC_DEFINE(SVN_DSO_SUFFIX_FMT, ["%d.%d.dylib"],
+                    [Shared library file name suffix format])
+          ;;
+        *)
+          AC_DEFINE(SVN_DSO_SUFFIX_FMT, ["%d.so.%d"],
+                    [Shared library file name suffix format])
+          ;;
+      esac
     fi
 ])
 

Propchange: subversion/branches/move-tracking-2/configure.ac
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May  5 09:24:27 2015
@@ -82,4 +82,4 @@
 /subversion/branches/verify-at-commit/configure.ac:1462039-1462408
 /subversion/branches/verify-keep-going/configure.ac:1439280-1546110
 /subversion/branches/wc-collate-path/configure.ac:1402685-1480384
-/subversion/trunk/configure.ac:1606692-1663280
+/subversion/trunk/configure.ac:1606692-1677758

Propchange: subversion/branches/move-tracking-2/subversion/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May  5 09:24:27 2015
@@ -82,4 +82,4 @@
 /subversion/branches/verify-at-commit/subversion:1462039-1462408
 /subversion/branches/verify-keep-going/subversion:1439280-1546110
 /subversion/branches/wc-collate-path/subversion:1402685-1480384
-/subversion/trunk/subversion:1606692-1676219
+/subversion/trunk/subversion:1606692-1677758

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/README
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/README?rev=1677760&r1=1677759&r2=1677760&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/README (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/README Tue May  5 09:24:27 2015
@@ -5,7 +5,7 @@ JavaHL provides a (mostly native, using
 a high level Java API for Subversion, which was originally targeted for
 implementors of GUI clients and IDE plug-ins for Subversion.  JavaHL
 currently provides a minimal-but-complete set of APIs which expose the
-core Subversion C API to Java.  It requires a JRE 1.5+ (runtime).
+core Subversion C API to Java.  It requires a JRE 1.6+ (runtime).
 
 It is currently quite mature, and can be considered for production use.
 
@@ -13,8 +13,9 @@ It is currently quite mature, and can be
 Build system
 ------------
 
-JavaHL should compile and run under Linux, Win32, and Mac OS X with a
-JDK 1.5+.
+JavaHL should compile and run under Linux, Win32, and Mac OS X with
+JDK 1.6+ and a C++ compiler with a complete implementation of
+C++98 (for example, GCC 3.2 and older cannot compile JavaHL 1.9+).
 
 Its build will produce both a native library (libsvnjavahl-1.so on Unix
 or libsvnjavahl-1.dll on Win32) and a platform independent archive of
@@ -22,26 +23,29 @@ Java bytecode (svn-javahl.jar).
 
 To build JavaHL on non-Win32 platforms, just add "--enable-javahl" to
 the configure script's parameters.  "--with-jdk" can be provided to
-specify the path to a jdk.  "--with-maintainer-mode" will compile Java
-bytecode with debugging information.  Jikes will be the preferred
-compiler if it is auto-detected.  If not auto-detected, you can force
-its use via the "--with-jikes=path" flag to configure.
+specify the path to a jdk.  "--enable-maintainer-mode" will compile
+Java bytecode with debugging information.
 
 The following make targets are provided:
 
-javahl                build javahl
-install-javahl        install javahl
-check-javahl          run javahl tests
+javahl                build JavaHL
+install-javahl        install JavaHL
+check-javahl          run JavaHL tests
+check-all-javahl      run all JavaHL tests, including tests for
+                      deprecated backward-compatibility APIs.
 
 (In order to run check-javahl, you must have specified a path to a JUnit
-jar file with --with-junit when running configure; JUnit version 3.8.1
+jar file with --with-junit when running configure; JUnit version 4.11
 has been tested.  JUnit can be downloaded from http://junit.org/ .)
 
 
 MacOS X:
 
-After building libsvnjavahl.dynlib, you must rename it to
-libsvnjavahl.jnilib.  Additionally, it should probably be installed in
+After building libsvnjavahl.dylib, you must rename it to
+libsvnjavahl.jnilib. Make install-javahl creates a symbolic
+link with the appropriate name.
+
+Additionally, it should probably be installed in
 /Library/Java/Extensions instead of wherever the build system chose to
 install it; patches to our build system to do this automatically are
 welcome.
@@ -60,6 +64,7 @@ Success stories
 ---------------
 
 Subclipse, Eclipse IDE plug-in <http://subclipse.tigris.org/>
+SmartSVN, cross-platform Subversion client (http://www.smartsvn.com/)
 
 
 Why not 100% pure Java?
@@ -86,6 +91,8 @@ as to its compatibility with the officia
 TODO
 ----
 
+o Transition all of the implementation to the new-style jniwrapper.
 o Expose more of Subversion's core libraries through JNI.
 o More JUnit test cases.
+o Refactor the JUnit tests to use the improved features of JUnit 4.
 o Improve JavaDoc and coding style.

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/native/CreateJ.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/native/CreateJ.cpp?rev=1677760&r1=1677759&r2=1677760&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/native/CreateJ.cpp (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/native/CreateJ.cpp Tue May  5 09:24:27 2015
@@ -1158,17 +1158,18 @@ void fill_property_map(jobject map,
         if (JNIUtil::isJavaExceptionThrown())
           return;
 
-        jbyteArray jpropVal = (!val ? NULL
-                               : JNIUtil::makeJByteArray(val));
+        jbyteArray jpropVal = (val ? JNIUtil::makeJByteArray(val) : NULL);
         if (JNIUtil::isJavaExceptionThrown())
           return;
 
-        m_env->CallObjectMethod(m_map, m_put_mid, jpropName, jpropVal);
+        jobject ret = m_env->CallObjectMethod(m_map, m_put_mid,
+                                              jpropName, jpropVal);
         if (JNIUtil::isJavaExceptionThrown())
           return;
 
-        m_env->DeleteLocalRef(jpropName);
+        m_env->DeleteLocalRef(ret);
         m_env->DeleteLocalRef(jpropVal);
+        m_env->DeleteLocalRef(jpropName);
       }
 
     JNIEnv*& m_env;
@@ -1214,6 +1215,7 @@ void fill_property_map(jobject map,
             POP_AND_RETURN_NOTHING();
         }
     }
+  POP_AND_RETURN_NOTHING();
 }
 
 jobject property_map(apr_hash_t *prop_hash, apr_array_header_t* prop_diffs,

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/native/EditorProxy.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/native/EditorProxy.cpp?rev=1677760&r1=1677759&r2=1677760&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/native/EditorProxy.cpp (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/native/EditorProxy.cpp Tue May  5 09:24:27 2015
@@ -151,29 +151,32 @@ EditorProxy::cb_add_directory(void *bato
                               apr_pool_t *scratch_pool)
 {
   //DEBUG:fprintf(stderr, "  (n) EditorProxy::cb_add_directory('%s')\n", relpath);
-
-  EditorProxy* const ep = static_cast<EditorProxy*>(baton);
-  if (!ep->m_valid)
-    return invalid_editor();
-
-  static jmethodID mid = 0;
-  SVN_ERR(get_editor_method(mid, "addDirectory",
-                            "(Ljava/lang/String;"
-                            "Ljava/lang/Iterable;"
-                            "Ljava/util/Map;J)V"));
-
-  jstring jrelpath = JNIUtil::makeJString(relpath);
-  SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED);
-  jobject jchildren = (!children ? NULL : CreateJ::StringSet(children));
-  SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED);
-  jobject jprops = CreateJ::PropertyMap(props, scratch_pool);
-  SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED);
-
-  SVN_JNI_CATCH(
-      JNIUtil::getEnv()->CallVoidMethod(ep->m_jeditor, mid,
-                                        jrelpath, jchildren, jprops,
-                                        jlong(replaces_rev)),
-      SVN_ERR_RA_SVN_EDIT_ABORTED);
+  const ::Java::Env env;
+  SVN_JAVAHL_CATCH(env, SVN_ERR_RA_SVN_EDIT_ABORTED,
+    {
+      ::Java::LocalFrame frame(env);
+
+      EditorProxy* const ep = static_cast<EditorProxy*>(baton);
+      if (!ep->m_valid)
+        return invalid_editor();
+
+      static jmethodID mid = 0;
+      SVN_ERR(get_editor_method(mid, "addDirectory",
+                                "(Ljava/lang/String;"
+                                "Ljava/lang/Iterable;"
+                                "Ljava/util/Map;J)V"));
+
+      jstring jrelpath = JNIUtil::makeJString(relpath);
+      SVN_JAVAHL_OLDSTYLE_EXCEPTION_CHECK(env);
+      jobject jchildren = (!children ? NULL : CreateJ::StringSet(children));
+      SVN_JAVAHL_OLDSTYLE_EXCEPTION_CHECK(env);
+      jobject jprops = CreateJ::PropertyMap(props, scratch_pool);
+      SVN_JAVAHL_OLDSTYLE_EXCEPTION_CHECK(env);
+
+      env.CallVoidMethod(ep->m_jeditor, mid,
+                         jrelpath, jchildren, jprops,
+                         jlong(replaces_rev));
+    });
   return SVN_NO_ERROR;
 }
 
@@ -187,36 +190,37 @@ EditorProxy::cb_add_file(void *baton,
                          apr_pool_t *scratch_pool)
 {
   //DEBUG:fprintf(stderr, "  (n) EditorProxy::cb_add_file('%s')\n", relpath);
-
-  EditorProxy* const ep = static_cast<EditorProxy*>(baton);
-  if (!ep || !ep->m_valid)
-    return invalid_editor();
-
-  static jmethodID mid = 0;
-  SVN_ERR(get_editor_method(mid, "addFile",
-                            "(Ljava/lang/String;"
-                            "L"JAVA_PACKAGE"/types/Checksum;"
-                            "Ljava/io/InputStream;"
-                            "Ljava/util/Map;J)V"));
-
-  jstring jrelpath = JNIUtil::makeJString(relpath);
-  SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED);
-  jobject jchecksum = CreateJ::Checksum(checksum);
-  SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED);
-  jobject jcontents = NULL;
-  SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED);
-  jobject jprops = CreateJ::PropertyMap(props, scratch_pool);
-  SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED);
-
-  if (contents != NULL)
-    SVN_JAVAHL_CATCH(Java::Env(), SVN_ERR_RA_SVN_EDIT_ABORTED,
-                     jcontents = wrap_input_stream(contents));
-
-  SVN_JNI_CATCH(
-      JNIUtil::getEnv()->CallVoidMethod(ep->m_jeditor, mid,
-                                        jrelpath, jchecksum, jcontents,
-                                        jprops, jlong(replaces_rev)),
-      SVN_ERR_RA_SVN_EDIT_ABORTED);
+  const ::Java::Env env;
+  SVN_JAVAHL_CATCH(env, SVN_ERR_RA_SVN_EDIT_ABORTED,
+    {
+      ::Java::LocalFrame frame(env);
+
+      EditorProxy* const ep = static_cast<EditorProxy*>(baton);
+      if (!ep || !ep->m_valid)
+        return invalid_editor();
+
+      static jmethodID mid = 0;
+      SVN_ERR(get_editor_method(mid, "addFile",
+                                "(Ljava/lang/String;"
+                                "L"JAVA_PACKAGE"/types/Checksum;"
+                                "Ljava/io/InputStream;"
+                                "Ljava/util/Map;J)V"));
+
+      jstring jrelpath = JNIUtil::makeJString(relpath);
+      SVN_JAVAHL_OLDSTYLE_EXCEPTION_CHECK(env);
+      jobject jchecksum = CreateJ::Checksum(checksum);
+      SVN_JAVAHL_OLDSTYLE_EXCEPTION_CHECK(env);
+      jobject jprops = CreateJ::PropertyMap(props, scratch_pool);
+      SVN_JAVAHL_OLDSTYLE_EXCEPTION_CHECK(env);
+
+      jobject jcontents = NULL;
+      if (contents != NULL)
+        jcontents = wrap_input_stream(contents);
+
+      env.CallVoidMethod(ep->m_jeditor, mid,
+                         jrelpath, jchecksum, jcontents,
+                         jprops, jlong(replaces_rev));
+    });
   return SVN_NO_ERROR;
 }
 
@@ -229,29 +233,32 @@ EditorProxy::cb_add_symlink(void *baton,
                             apr_pool_t *scratch_pool)
 {
   //DEBUG:fprintf(stderr, "  (n) EditorProxy::cb_add_symlink('%s')\n", relpath);
-
-  EditorProxy* const ep = static_cast<EditorProxy*>(baton);
-  if (!ep || !ep->m_valid)
-    return invalid_editor();
-
-  static jmethodID mid = 0;
-  SVN_ERR(get_editor_method(mid, "addSymlink",
-                            "(Ljava/lang/String;"
-                            "Ljava/lang/String;"
-                            "Ljava/util/Map;J)V"));
-
-  jstring jrelpath = JNIUtil::makeJString(relpath);
-  SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED);
-  jstring jtarget = JNIUtil::makeJString(target);
-  SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED);
-  jobject jprops = CreateJ::PropertyMap(props, scratch_pool);
-  SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED);
-
-  SVN_JNI_CATCH(
-      JNIUtil::getEnv()->CallVoidMethod(ep->m_jeditor, mid,
-                                        jrelpath, jtarget, jprops,
-                                        jlong(replaces_rev)),
-      SVN_ERR_RA_SVN_EDIT_ABORTED);
+  const ::Java::Env env;
+  SVN_JAVAHL_CATCH(env, SVN_ERR_RA_SVN_EDIT_ABORTED,
+    {
+      ::Java::LocalFrame frame(env);
+
+      EditorProxy* const ep = static_cast<EditorProxy*>(baton);
+      if (!ep || !ep->m_valid)
+        return invalid_editor();
+
+      static jmethodID mid = 0;
+      SVN_ERR(get_editor_method(mid, "addSymlink",
+                                "(Ljava/lang/String;"
+                                "Ljava/lang/String;"
+                                "Ljava/util/Map;J)V"));
+
+      jstring jrelpath = JNIUtil::makeJString(relpath);
+      SVN_JAVAHL_OLDSTYLE_EXCEPTION_CHECK(env);
+      jstring jtarget = JNIUtil::makeJString(target);
+      SVN_JAVAHL_OLDSTYLE_EXCEPTION_CHECK(env);
+      jobject jprops = CreateJ::PropertyMap(props, scratch_pool);
+      SVN_JAVAHL_OLDSTYLE_EXCEPTION_CHECK(env);
+
+      env.CallVoidMethod(ep->m_jeditor, mid,
+                         jrelpath, jtarget, jprops,
+                         jlong(replaces_rev));
+    });
   return SVN_NO_ERROR;
 }
 
@@ -263,27 +270,30 @@ EditorProxy::cb_add_absent(void *baton,
                            apr_pool_t *scratch_pool)
 {
   //DEBUG:fprintf(stderr, "  (n) EditorProxy::cb_add_absent('%s')\n", relpath);
-
-  EditorProxy* const ep = static_cast<EditorProxy*>(baton);
-  if (!ep || !ep->m_valid)
-    return invalid_editor();
-
-  static jmethodID mid = 0;
-  SVN_ERR(get_editor_method(mid, "addAbsent",
-                            "(Ljava/lang/String;"
-                            "L"JAVA_PACKAGE"/types/NodeKind;"
-                            "J)V"));
-
-  jstring jrelpath = JNIUtil::makeJString(relpath);
-  SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED);
-  jobject jkind = EnumMapper::mapNodeKind(kind);
-  SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED);
-
-  SVN_JNI_CATCH(
-      JNIUtil::getEnv()->CallVoidMethod(ep->m_jeditor, mid,
-                                        jrelpath, jkind,
-                                        jlong(replaces_rev)),
-      SVN_ERR_RA_SVN_EDIT_ABORTED);
+  const ::Java::Env env;
+  SVN_JAVAHL_CATCH(env, SVN_ERR_RA_SVN_EDIT_ABORTED,
+    {
+      ::Java::LocalFrame frame(env);
+
+      EditorProxy* const ep = static_cast<EditorProxy*>(baton);
+      if (!ep || !ep->m_valid)
+        return invalid_editor();
+
+      static jmethodID mid = 0;
+      SVN_ERR(get_editor_method(mid, "addAbsent",
+                                "(Ljava/lang/String;"
+                                "L"JAVA_PACKAGE"/types/NodeKind;"
+                                "J)V"));
+
+      jstring jrelpath = JNIUtil::makeJString(relpath);
+      SVN_JAVAHL_OLDSTYLE_EXCEPTION_CHECK(env);
+      jobject jkind = EnumMapper::mapNodeKind(kind);
+      SVN_JAVAHL_OLDSTYLE_EXCEPTION_CHECK(env);
+
+      env.CallVoidMethod(ep->m_jeditor, mid,
+                         jrelpath, jkind,
+                         jlong(replaces_rev));
+    });
   return SVN_NO_ERROR;
 }
 
@@ -297,29 +307,32 @@ EditorProxy::cb_alter_directory(void *ba
 {
   //DEBUG:fprintf(stderr, "  (n) EditorProxy::cb_alter_directory('%s', r%lld)\n",
   //DEBUG:        relpath, static_cast<long long>(revision));
-
-  EditorProxy* const ep = static_cast<EditorProxy*>(baton);
-  if (!ep || !ep->m_valid)
-    return invalid_editor();
-
-  static jmethodID mid = 0;
-  SVN_ERR(get_editor_method(mid, "alterDirectory",
-                            "(Ljava/lang/String;J"
-                            "Ljava/lang/Iterable;"
-                            "Ljava/util/Map;)V"));
-
-  jstring jrelpath = JNIUtil::makeJString(relpath);
-  SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED);
-  jobject jchildren = (!children ? NULL : CreateJ::StringSet(children));
-  SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED);
-  jobject jprops = CreateJ::PropertyMap(props, scratch_pool);
-  SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED);
-
-  SVN_JNI_CATCH(
-      JNIUtil::getEnv()->CallVoidMethod(ep->m_jeditor, mid,
-                                        jrelpath, jlong(revision),
-                                        jchildren, jprops),
-      SVN_ERR_RA_SVN_EDIT_ABORTED);
+  const ::Java::Env env;
+  SVN_JAVAHL_CATCH(env, SVN_ERR_RA_SVN_EDIT_ABORTED,
+    {
+      ::Java::LocalFrame frame(env);
+
+      EditorProxy* const ep = static_cast<EditorProxy*>(baton);
+      if (!ep || !ep->m_valid)
+        return invalid_editor();
+
+      static jmethodID mid = 0;
+      SVN_ERR(get_editor_method(mid, "alterDirectory",
+                                "(Ljava/lang/String;J"
+                                "Ljava/lang/Iterable;"
+                                "Ljava/util/Map;)V"));
+
+      jstring jrelpath = JNIUtil::makeJString(relpath);
+      SVN_JAVAHL_OLDSTYLE_EXCEPTION_CHECK(env);
+      jobject jchildren = (!children ? NULL : CreateJ::StringSet(children));
+      SVN_JAVAHL_OLDSTYLE_EXCEPTION_CHECK(env);
+      jobject jprops = CreateJ::PropertyMap(props, scratch_pool);
+      SVN_JAVAHL_OLDSTYLE_EXCEPTION_CHECK(env);
+
+      env.CallVoidMethod(ep->m_jeditor, mid,
+                         jrelpath, jlong(revision),
+                         jchildren, jprops);
+    });
   return SVN_NO_ERROR;
 }
 
@@ -334,36 +347,37 @@ EditorProxy::cb_alter_file(void *baton,
 {
   //DEBUG:fprintf(stderr, "  (n) EditorProxy::cb_alter_file('%s', r%lld)\n",
   //DEBUG:        relpath, static_cast<long long>(revision));
-
-  EditorProxy* const ep = static_cast<EditorProxy*>(baton);
-  if (!ep || !ep->m_valid)
-    return invalid_editor();
-
-  static jmethodID mid = 0;
-  SVN_ERR(get_editor_method(mid, "alterFile",
-                            "(Ljava/lang/String;J"
-                            "L"JAVA_PACKAGE"/types/Checksum;"
-                            "Ljava/io/InputStream;"
-                            "Ljava/util/Map;)V"));
-
-  jstring jrelpath = JNIUtil::makeJString(relpath);
-  SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED);
-  jobject jchecksum = CreateJ::Checksum(checksum);
-  SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED);
-  jobject jcontents = NULL;
-  SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED);
-  jobject jprops = CreateJ::PropertyMap(props, scratch_pool);
-  SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED);
-
-  if (contents != NULL)
-    SVN_JAVAHL_CATCH(Java::Env(), SVN_ERR_RA_SVN_EDIT_ABORTED,
-                     jcontents = wrap_input_stream(contents));
-
-  SVN_JNI_CATCH(
-      JNIUtil::getEnv()->CallVoidMethod(ep->m_jeditor, mid,
-                                        jrelpath, jlong(revision),
-                                        jchecksum, jcontents, jprops),
-      SVN_ERR_RA_SVN_EDIT_ABORTED);
+  const ::Java::Env env;
+  SVN_JAVAHL_CATCH(env, SVN_ERR_RA_SVN_EDIT_ABORTED,
+    {
+      ::Java::LocalFrame frame(env);
+
+      EditorProxy* const ep = static_cast<EditorProxy*>(baton);
+      if (!ep || !ep->m_valid)
+        return invalid_editor();
+
+      static jmethodID mid = 0;
+      SVN_ERR(get_editor_method(mid, "alterFile",
+                                "(Ljava/lang/String;J"
+                                "L"JAVA_PACKAGE"/types/Checksum;"
+                                "Ljava/io/InputStream;"
+                                "Ljava/util/Map;)V"));
+
+      jstring jrelpath = JNIUtil::makeJString(relpath);
+      SVN_JAVAHL_OLDSTYLE_EXCEPTION_CHECK(env);
+      jobject jchecksum = CreateJ::Checksum(checksum);
+      SVN_JAVAHL_OLDSTYLE_EXCEPTION_CHECK(env);
+      jobject jprops = CreateJ::PropertyMap(props, scratch_pool);
+      SVN_JAVAHL_OLDSTYLE_EXCEPTION_CHECK(env);
+
+      jobject jcontents = NULL;
+      if (contents != NULL)
+        jcontents = wrap_input_stream(contents);
+
+      env.CallVoidMethod(ep->m_jeditor, mid,
+                         jrelpath, jlong(revision),
+                         jchecksum, jcontents, jprops);
+    });
   return SVN_NO_ERROR;
 }
 
@@ -377,29 +391,32 @@ EditorProxy::cb_alter_symlink(void *bato
 {
   //DEBUG:fprintf(stderr, "  (n) EditorProxy::cb_alter_symlink('%s', r%lld)\n",
   //DEBUG:        relpath, static_cast<long long>(revision));
-
-  EditorProxy* const ep = static_cast<EditorProxy*>(baton);
-  if (!ep || !ep->m_valid)
-    return invalid_editor();
-
-  static jmethodID mid = 0;
-  SVN_ERR(get_editor_method(mid, "alterSymlink",
-                            "(Ljava/lang/String;J"
-                            "Ljava/lang/String;"
-                            "Ljava/util/Map;)V"));
-
-  jstring jrelpath = JNIUtil::makeJString(relpath);
-  SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED);
-  jstring jtarget = JNIUtil::makeJString(target);
-  SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED);
-  jobject jprops = CreateJ::PropertyMap(props, scratch_pool);
-  SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED);
-
-  SVN_JNI_CATCH(
-      JNIUtil::getEnv()->CallVoidMethod(ep->m_jeditor, mid,
-                                        jrelpath, jlong(revision),
-                                        jtarget, jprops),
-      SVN_ERR_RA_SVN_EDIT_ABORTED);
+  const ::Java::Env env;
+  SVN_JAVAHL_CATCH(env, SVN_ERR_RA_SVN_EDIT_ABORTED,
+    {
+      ::Java::LocalFrame frame(env);
+
+      EditorProxy* const ep = static_cast<EditorProxy*>(baton);
+      if (!ep || !ep->m_valid)
+        return invalid_editor();
+
+      static jmethodID mid = 0;
+      SVN_ERR(get_editor_method(mid, "alterSymlink",
+                                "(Ljava/lang/String;J"
+                                "Ljava/lang/String;"
+                                "Ljava/util/Map;)V"));
+
+      jstring jrelpath = JNIUtil::makeJString(relpath);
+      SVN_JAVAHL_OLDSTYLE_EXCEPTION_CHECK(env);
+      jstring jtarget = JNIUtil::makeJString(target);
+      SVN_JAVAHL_OLDSTYLE_EXCEPTION_CHECK(env);
+      jobject jprops = CreateJ::PropertyMap(props, scratch_pool);
+      SVN_JAVAHL_OLDSTYLE_EXCEPTION_CHECK(env);
+
+      env.CallVoidMethod(ep->m_jeditor, mid,
+                         jrelpath, jlong(revision),
+                         jtarget, jprops);
+    });
   return SVN_NO_ERROR;
 }
 
@@ -411,21 +428,24 @@ EditorProxy::cb_delete(void *baton,
 {
   //DEBUG:fprintf(stderr, "  (n) EditorProxy::cb_delete('%s', r%lld)\n",
   //DEBUG:        relpath, static_cast<long long>(revision));
+  const ::Java::Env env;
+  SVN_JAVAHL_CATCH(env, SVN_ERR_RA_SVN_EDIT_ABORTED,
+    {
+      ::Java::LocalFrame frame(env);
+
+      EditorProxy* const ep = static_cast<EditorProxy*>(baton);
+      if (!ep || !ep->m_valid)
+        return invalid_editor();
+
+      static jmethodID mid = 0;
+      SVN_ERR(get_editor_method(mid, "delete",
+                                "(Ljava/lang/String;J)V"));
+
+      jstring jrelpath = JNIUtil::makeJString(relpath);
+      SVN_JAVAHL_OLDSTYLE_EXCEPTION_CHECK(env);
 
-  EditorProxy* const ep = static_cast<EditorProxy*>(baton);
-  if (!ep || !ep->m_valid)
-    return invalid_editor();
-
-  static jmethodID mid = 0;
-  SVN_ERR(get_editor_method(mid, "delete",
-                            "(Ljava/lang/String;J)V"));
-
-  jstring jrelpath = JNIUtil::makeJString(relpath);
-  SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED);
-
-  SVN_JNI_CATCH(
-      JNIUtil::getEnv()->CallVoidMethod(ep->m_jeditor, mid, jrelpath),
-      SVN_ERR_RA_SVN_EDIT_ABORTED);
+      env.CallVoidMethod(ep->m_jeditor, mid, jrelpath);
+    });
   return SVN_NO_ERROR;
 }
 
@@ -439,26 +459,29 @@ EditorProxy::cb_copy(void *baton,
 {
   //DEBUG:fprintf(stderr, "  (n) EditorProxy::cb_copy('%s', r%lld, '%s')\n",
   //DEBUG:        src_relpath, static_cast<long long>(src_revision), dst_relpath);
-
-  EditorProxy* const ep = static_cast<EditorProxy*>(baton);
-  if (!ep || !ep->m_valid)
-    return invalid_editor();
-
-  static jmethodID mid = 0;
-  SVN_ERR(get_editor_method(mid, "copy",
-                            "(Ljava/lang/String;J"
-                            "Ljava/lang/String;J)V"));
-
-  jstring jsrc_relpath = JNIUtil::makeJString(src_relpath);
-  SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED);
-  jstring jdst_relpath = JNIUtil::makeJString(dst_relpath);
-  SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED);
-
-  SVN_JNI_CATCH(
-      JNIUtil::getEnv()->CallVoidMethod(ep->m_jeditor, mid,
-                                        jsrc_relpath, jlong(src_revision),
-                                        jdst_relpath, jlong(replaces_rev)),
-      SVN_ERR_RA_SVN_EDIT_ABORTED);
+  const ::Java::Env env;
+  SVN_JAVAHL_CATCH(env, SVN_ERR_RA_SVN_EDIT_ABORTED,
+    {
+      ::Java::LocalFrame frame(env);
+
+      EditorProxy* const ep = static_cast<EditorProxy*>(baton);
+      if (!ep || !ep->m_valid)
+        return invalid_editor();
+
+      static jmethodID mid = 0;
+      SVN_ERR(get_editor_method(mid, "copy",
+                                "(Ljava/lang/String;J"
+                                "Ljava/lang/String;J)V"));
+
+      jstring jsrc_relpath = JNIUtil::makeJString(src_relpath);
+      SVN_JAVAHL_OLDSTYLE_EXCEPTION_CHECK(env);
+      jstring jdst_relpath = JNIUtil::makeJString(dst_relpath);
+      SVN_JAVAHL_OLDSTYLE_EXCEPTION_CHECK(env);
+
+      env.CallVoidMethod(ep->m_jeditor, mid,
+                         jsrc_relpath, jlong(src_revision),
+                         jdst_relpath, jlong(replaces_rev));
+    });
   return SVN_NO_ERROR;
 }
 
@@ -472,26 +495,29 @@ EditorProxy::cb_move(void *baton,
 {
   //DEBUG:fprintf(stderr, "  (n) EditorProxy::cb_move('%s', r%lld, '%s')\n",
   //DEBUG:        src_relpath, static_cast<long long>(src_revision), dst_relpath);
-
-  EditorProxy* const ep = static_cast<EditorProxy*>(baton);
-  if (!ep || !ep->m_valid)
-    return invalid_editor();
-
-  static jmethodID mid = 0;
-  SVN_ERR(get_editor_method(mid, "move",
-                            "(Ljava/lang/String;J"
-                            "Ljava/lang/String;J)V"));
-
-  jstring jsrc_relpath = JNIUtil::makeJString(src_relpath);
-  SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED);
-  jstring jdst_relpath = JNIUtil::makeJString(dst_relpath);
-  SVN_JNI_CATCH(,SVN_ERR_RA_SVN_EDIT_ABORTED);
-
-  SVN_JNI_CATCH(
-      JNIUtil::getEnv()->CallVoidMethod(ep->m_jeditor, mid,
-                                        jsrc_relpath, jlong(src_revision),
-                                        jdst_relpath, jlong(replaces_rev)),
-      SVN_ERR_RA_SVN_EDIT_ABORTED);
+  const ::Java::Env env;
+  SVN_JAVAHL_CATCH(env, SVN_ERR_RA_SVN_EDIT_ABORTED,
+    {
+      ::Java::LocalFrame frame(env);
+
+      EditorProxy* const ep = static_cast<EditorProxy*>(baton);
+      if (!ep || !ep->m_valid)
+        return invalid_editor();
+
+      static jmethodID mid = 0;
+      SVN_ERR(get_editor_method(mid, "move",
+                                "(Ljava/lang/String;J"
+                                "Ljava/lang/String;J)V"));
+
+      jstring jsrc_relpath = JNIUtil::makeJString(src_relpath);
+      SVN_JAVAHL_OLDSTYLE_EXCEPTION_CHECK(env);
+      jstring jdst_relpath = JNIUtil::makeJString(dst_relpath);
+      SVN_JAVAHL_OLDSTYLE_EXCEPTION_CHECK(env);
+
+      env.CallVoidMethod(ep->m_jeditor, mid,
+                         jsrc_relpath, jlong(src_revision),
+                         jdst_relpath, jlong(replaces_rev));
+    });
   return SVN_NO_ERROR;
 }
 
@@ -499,18 +525,21 @@ svn_error_t*
 EditorProxy::cb_complete(void *baton, apr_pool_t *scratch_pool)
 {
   //DEBUG:fprintf(stderr, "  (n) EditorProxy::cb_complete()\n");
+  const ::Java::Env env;
+  SVN_JAVAHL_CATCH(env, SVN_ERR_RA_SVN_EDIT_ABORTED,
+    {
+      ::Java::LocalFrame frame(env);
+
+      EditorProxy* const ep = static_cast<EditorProxy*>(baton);
+      if (!ep || !ep->m_valid)
+        return invalid_editor();
+      ep->m_valid = false;
+
+      static jmethodID mid = 0;
+      SVN_ERR(get_editor_method(mid, "complete", "()V"));
 
-  EditorProxy* const ep = static_cast<EditorProxy*>(baton);
-  if (!ep || !ep->m_valid)
-    return invalid_editor();
-  ep->m_valid = false;
-
-  static jmethodID mid = 0;
-  SVN_ERR(get_editor_method(mid, "complete", "()V"));
-
-  SVN_JNI_CATCH(
-      JNIUtil::getEnv()->CallVoidMethod(ep->m_jeditor, mid),
-      SVN_ERR_RA_SVN_EDIT_ABORTED);
+      env.CallVoidMethod(ep->m_jeditor, mid);
+    });
   return SVN_NO_ERROR;
 }
 
@@ -518,17 +547,20 @@ svn_error_t*
 EditorProxy::cb_abort(void *baton, apr_pool_t *scratch_pool)
 {
   //DEBUG:fprintf(stderr, "  (n) EditorProxy::cb_abort()\n");
+  const ::Java::Env env;
+  SVN_JAVAHL_CATCH(env, SVN_ERR_RA_SVN_EDIT_ABORTED,
+    {
+      ::Java::LocalFrame frame(env);
+
+      EditorProxy* const ep = static_cast<EditorProxy*>(baton);
+      if (!ep || !ep->m_valid)
+        return invalid_editor();
+      ep->m_valid = false;
+
+      static jmethodID mid = 0;
+      SVN_ERR(get_editor_method(mid, "abort", "()V"));
 
-  EditorProxy* const ep = static_cast<EditorProxy*>(baton);
-  if (!ep || !ep->m_valid)
-    return invalid_editor();
-  ep->m_valid = false;
-
-  static jmethodID mid = 0;
-  SVN_ERR(get_editor_method(mid, "abort", "()V"));
-
-  SVN_JNI_CATCH(
-      JNIUtil::getEnv()->CallVoidMethod(ep->m_jeditor, mid),
-      SVN_ERR_RA_SVN_EDIT_ABORTED);
+      env.CallVoidMethod(ep->m_jeditor, mid);
+    });
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/native/NativeStream.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/native/NativeStream.cpp?rev=1677760&r1=1677759&r2=1677760&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/native/NativeStream.cpp (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/native/NativeStream.cpp Tue May  5 09:24:27 2015
@@ -45,16 +45,23 @@ void NativeInputStream::set_stream(svn_s
 }
 
 NativeInputStream*
-NativeInputStream::get_self(::Java::Env env, jobject jthis)
+NativeInputStream::get_self_unsafe(::Java::Env env, jobject jthis)
 {
   jfieldID fid_cppaddr = NULL;
   const jlong cppaddr =
     findCppAddrForJObject(jthis, &fid_cppaddr, m_class_name);
-  if (!cppaddr)
-    ::Java::NullPointerException(env).raise(_("this [C++]"));
   return reinterpret_cast<NativeInputStream*>(cppaddr);
 }
 
+NativeInputStream*
+NativeInputStream::get_self(::Java::Env env, jobject jthis)
+{
+  NativeInputStream* self = get_self_unsafe(env, jthis);
+  if (!self)
+    ::Java::NullPointerException(env).raise(_("this [C++]"));
+  return self;
+}
+
 void NativeInputStream::close(::Java::Env env, jobject jthis)
 {
   SVN_JAVAHL_CHECK(env, svn_stream_close(m_stream));
@@ -149,16 +156,23 @@ void NativeOutputStream::set_stream(svn_
 }
 
 NativeOutputStream*
-NativeOutputStream::get_self(::Java::Env env, jobject jthis)
+NativeOutputStream::get_self_unsafe(::Java::Env env, jobject jthis)
 {
   jfieldID fid_cppaddr = NULL;
   const jlong cppaddr =
     findCppAddrForJObject(jthis, &fid_cppaddr, m_class_name);
-  if (!cppaddr)
-    ::Java::NullPointerException(env).raise(_("this [C++]"));
   return reinterpret_cast<NativeOutputStream*>(cppaddr);
 }
 
+NativeOutputStream*
+NativeOutputStream::get_self(::Java::Env env, jobject jthis)
+{
+  NativeOutputStream* self = get_self_unsafe(env, jthis);
+  if (!self)
+    ::Java::NullPointerException(env).raise(_("this [C++]"));
+  return self;
+}
+
 void NativeOutputStream::close(::Java::Env env, jobject jthis)
 {
   SVN_JAVAHL_CHECK(env, svn_stream_close(m_stream));
@@ -294,6 +308,20 @@ Java_org_apache_subversion_javahl_types_
   return 0;
 }
 
+JNIEXPORT void JNICALL
+Java_org_apache_subversion_javahl_types_NativeInputStream_finalize(
+    JNIEnv* jenv, jobject jthis)
+{
+  SVN_JAVAHL_JNI_TRY(NativeInputStream, finalize)
+    {
+      JavaHL::NativeInputStream* native =
+        JavaHL::NativeInputStream::get_self_unsafe(Java::Env(jenv), jthis);
+      if (native != NULL)
+          native->finalize();
+    }
+  SVN_JAVAHL_JNI_CATCH;
+}
+
 
 // Class JavaHL::NativeOutputStream native method implementation
 #include "../include/org_apache_subversion_javahl_types_NativeOutputStream.h"
@@ -337,3 +365,17 @@ Java_org_apache_subversion_javahl_types_
     }
   SVN_JAVAHL_JNI_CATCH_TO_EXCEPTION(Java::IOException);
 }
+
+JNIEXPORT void JNICALL
+Java_org_apache_subversion_javahl_types_NativeOutputStream_finalize(
+    JNIEnv* jenv, jobject jthis)
+{
+  SVN_JAVAHL_JNI_TRY(NativeOutputStream, finalize)
+    {
+      JavaHL::NativeOutputStream* native =
+        JavaHL::NativeOutputStream::get_self_unsafe(Java::Env(jenv), jthis);
+      if (native != NULL)
+          native->finalize();
+    }
+  SVN_JAVAHL_JNI_CATCH;
+}

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/native/NativeStream.hpp
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/native/NativeStream.hpp?rev=1677760&r1=1677759&r2=1677760&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/native/NativeStream.hpp (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/native/NativeStream.hpp Tue May  5 09:24:27 2015
@@ -81,6 +81,8 @@ public:
    */
   static NativeInputStream* get_self(::Java::Env env, jobject jthis);
 
+  static NativeInputStream* get_self_unsafe(::Java::Env env, jobject jthis);
+
 public:
   /**
    * Implements @c InputStream.close().
@@ -176,6 +178,8 @@ public:
    */
   static NativeOutputStream* get_self(::Java::Env env, jobject jthis);
 
+  static NativeOutputStream* get_self_unsafe(::Java::Env env, jobject jthis);
+
 public:
   /**
    * Implements @c OutputStream.close().

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/native/jniwrapper/jni_base.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/native/jniwrapper/jni_base.cpp?rev=1677760&r1=1677759&r2=1677760&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/native/jniwrapper/jni_base.cpp (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/native/jniwrapper/jni_base.cpp Tue May  5 09:24:27 2015
@@ -179,30 +179,6 @@ void Env::throw_java_out_of_memory(const
 const jint LocalFrame::DEFAULT_CAPACITY = 16;
 
 
-// class Java::GlobalObject
-
-GlobalObject& GlobalObject::operator=(jobject that)
-{
-  this->~GlobalObject();
-  return *new(this) GlobalObject(Env(), that);
-}
-
-GlobalObject::~GlobalObject()
-{
-  if (m_obj)
-    Env().DeleteGlobalRef(m_obj);
-}
-
-
-// class Java::GlobalClass
-
-GlobalClass& GlobalClass::operator=(jclass that)
-{
-  this->~GlobalClass();
-  return *new(this) GlobalClass(Env(), that);
-}
-
-
 // Class Java::Object
 
 const char* const Object::m_class_name = "java/lang/Object";

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/native/jniwrapper/jni_globalref.hpp
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/native/jniwrapper/jni_globalref.hpp?rev=1677760&r1=1677759&r2=1677760&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/native/jniwrapper/jni_globalref.hpp (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/native/jniwrapper/jni_globalref.hpp Tue May  5 09:24:27 2015
@@ -24,6 +24,8 @@
 #ifndef SVN_JAVAHL_JNIWRAPPER_GLOBALREF_HPP
 #define SVN_JAVAHL_JNIWRAPPER_GLOBALREF_HPP
 
+#include <memory>
+
 #include <jni.h>
 
 #include "jni_env.hpp"
@@ -43,11 +45,19 @@ public:
     : m_obj(obj ? env.NewGlobalRef(obj) : NULL)
     {}
 
-  ~GlobalObject();
+  ~GlobalObject() throw()
+    {
+      if (m_obj)
+        Env().DeleteGlobalRef(m_obj);
+    }
 
-  GlobalObject& operator=(jobject that);
+  GlobalObject& operator=(jobject that)
+    {
+      this->~GlobalObject();
+      return *new(this) GlobalObject(Env(), that);
+    }
 
-  jobject get() const
+  jobject get() const throw()
     {
       return m_obj;
     }
@@ -73,9 +83,13 @@ public:
     : GlobalObject(env, cls)
     {}
 
-  GlobalClass& operator=(jclass that);
+  GlobalClass& operator=(jclass that)
+    {
+      GlobalObject::operator=(that);
+      return *this;
+    }
 
-  jclass get() const
+  jclass get() const throw()
     {
       return jclass(GlobalObject::get());
     }

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java?rev=1677760&r1=1677759&r2=1677760&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java Tue May  5 09:24:27 2015
@@ -502,9 +502,9 @@ public interface ISVNClient
      * Recursively cleans up a local directory, finishing any
      * incomplete operations, removing lockfiles, etc.
      * <p>
-     * Behaves like the 1.9 version with <code>breakLocks</code> and
-     * <code>includeExternals</code> set to <code>false<code>, and the
-     * other flags to <code>true</code>.
+     * Behaves like the 1.9 version with <code>includeExternals</code>
+     * set to <code>false<code>, and the other flags to
+     * <code>true</code>.
      * @param path a local directory.
      * @throws ClientException
      */

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java?rev=1677760&r1=1677759&r2=1677760&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java Tue May  5 09:24:27 2015
@@ -294,7 +294,7 @@ public class SVNClient implements ISVNCl
 
     public void cleanup(String path) throws ClientException
     {
-        cleanup(path, false, true, true, true, false);
+        cleanup(path, true, true, true, true, false);
     }
 
     public native void resolve(String path, Depth depth,

Modified: subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StatusEditor.java
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StatusEditor.java?rev=1677760&r1=1677759&r2=1677760&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StatusEditor.java (original)
+++ subversion/branches/move-tracking-2/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StatusEditor.java Tue May  5 09:24:27 2015
@@ -79,10 +79,12 @@ class StatusEditor implements ISVNEditor
                         long replacesRevision)
     {
         //DEBUG:System.err.println("  [J] StatusEditor.addFile");
-        try {
-            contents.close();
-        } catch (IOException ex) {
-            throw new RuntimeException(ex);
+        if (contents != null) {
+            try {
+                contents.close();
+            } catch (IOException ex) {
+                throw new RuntimeException(ex);
+            }
         }
 
         checkState();
@@ -127,10 +129,12 @@ class StatusEditor implements ISVNEditor
                           Map<String, byte[]> properties)
     {
         //DEBUG:System.err.println("  [J] StatusEditor.alterFile");
-        try {
-            contents.close();
-        } catch (IOException ex) {
-            throw new RuntimeException(ex);
+        if (contents != null) {
+            try {
+                contents.close();
+            } catch (IOException ex) {
+                throw new RuntimeException(ex);
+            }
         }
 
         checkState();

Modified: subversion/branches/move-tracking-2/subversion/include/private/svn_subr_private.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/include/private/svn_subr_private.h?rev=1677760&r1=1677759&r2=1677760&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/include/private/svn_subr_private.h (original)
+++ subversion/branches/move-tracking-2/subversion/include/private/svn_subr_private.h Tue May  5 09:24:27 2015
@@ -681,6 +681,11 @@ svn_boolean_t
 svn_bit_array__get(svn_bit_array__t *array,
                    apr_size_t idx);
 
+/* Return the global pool used by the DSO loader, this may be NULL if
+   no DSOs have been loaded. */
+apr_pool_t *
+svn_dso__pool(void);
+
 /** @} */
 
 #ifdef __cplusplus

Modified: subversion/branches/move-tracking-2/subversion/libsvn_client/copy.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_client/copy.c?rev=1677760&r1=1677759&r2=1677760&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_client/copy.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_client/copy.c Tue May  5 09:24:27 2015
@@ -300,10 +300,12 @@ make_external_description(const char **n
   return SVN_NO_ERROR;
 }
 
-/* Pin all externals listed in EXTERNALS_PROP_VAL to their last-changed
- * revision. Return a new property value in *PINNED_EXTERNALS allocated
- * in RESULT_POOL. LOCAL_ABSPATH_OR_URL is the path or URL defining the
- * svn:externals property. Use SCRATCH_POOL for temporary allocations.
+/* Pin all externals listed in EXTERNALS_PROP_VAL to their
+ * last-changed revision. Set *PINNED_EXTERNALS to a new property
+ * value allocated in RESULT_POOL, or to NULL if none of the externals
+ * in EXTERNALS_PROP_VAL were changed. LOCAL_ABSPATH_OR_URL is the
+ * path or URL defining the svn:externals property. Use SCRATCH_POOL
+ * for temporary allocations.
  */
 static svn_error_t *
 pin_externals_prop(svn_string_t **pinned_externals,
@@ -319,6 +321,7 @@ pin_externals_prop(svn_string_t **pinned
   apr_array_header_t *external_items;
   apr_array_header_t *parser_infos;
   apr_array_header_t *items_to_pin;
+  int pinned_items;
   int i;
   apr_pool_t *iterpool;
 
@@ -336,7 +339,7 @@ pin_externals_prop(svn_string_t **pinned
       if (!items_to_pin)
         {
           /* No pinning at all for this path. */
-          *pinned_externals = svn_string_dup(externals_prop_val, result_pool);
+          *pinned_externals = NULL;
           return SVN_NO_ERROR;
         }
     }
@@ -345,6 +348,7 @@ pin_externals_prop(svn_string_t **pinned
 
   buf = svn_stringbuf_create_empty(scratch_pool);
   iterpool = svn_pool_create(scratch_pool);
+  pinned_items = 0;
   for (i = 0; i < external_items->nelts; i++)
     {
       svn_wc_external_item2_t *item;
@@ -394,11 +398,13 @@ pin_externals_prop(svn_string_t **pinned
 
       if (item->peg_revision.kind == svn_opt_revision_date)
         {
+          /* Already pinned ... copy the peg date. */
           external_pegrev.kind = svn_opt_revision_date;
           external_pegrev.value.date = item->peg_revision.value.date;
         }
       else if (item->peg_revision.kind == svn_opt_revision_number)
         {
+          /* Already pinned ... copy the peg revision number. */
           external_pegrev.kind = svn_opt_revision_number;
           external_pegrev.value.number = item->peg_revision.value.number;
         }
@@ -408,6 +414,9 @@ pin_externals_prop(svn_string_t **pinned
             item->peg_revision.kind == svn_opt_revision_head ||
             item->peg_revision.kind == svn_opt_revision_unspecified);
 
+          /* We're actually going to change the peg revision. */
+          ++pinned_items;
+
           if (svn_path_is_url(local_abspath_or_url))
             {
               const char *resolved_url;
@@ -547,14 +556,19 @@ pin_externals_prop(svn_string_t **pinned
     }
   svn_pool_destroy(iterpool);
 
-  *pinned_externals = svn_string_create_from_buf(buf, result_pool);
+  if (pinned_items > 0)
+    *pinned_externals = svn_string_create_from_buf(buf, result_pool);
+  else
+    *pinned_externals = NULL;
 
   return SVN_NO_ERROR;
 }
 
-/* Return, in *NEW_EXTERNALS, a new hash of externals definitions, some or
- * which all of which are pinned. If EXTERNALS_TO_PIN is NULL, pin all
- * externals, else pin the externals mentioned in EXTERNALS_TO_PIN.
+/* Return, in *PINNED_EXTERNALS, a new hash mapping URLs or local abspaths
+ * to svn:externals property values (as const char *), where some or all
+ * external references have been pinned.
+ * If EXTERNALS_TO_PIN is NULL, pin all externals, else pin the externals
+ * mentioned in EXTERNALS_TO_PIN.
  * The pinning operation takes place as part of the copy operation for
  * the source/destination pair PAIR. Use RA_SESSION and REPOS_ROOT_URL
  * to contact the repository containing the externals definition, if neccesary.
@@ -562,7 +576,7 @@ pin_externals_prop(svn_string_t **pinned
  * neccessary. Allocate *NEW_EXTERNALS in RESULT_POOL.
  * Use SCRATCH_POOL for temporary allocations. */
 static svn_error_t *
-resolve_pinned_externals(apr_hash_t **new_externals,
+resolve_pinned_externals(apr_hash_t **pinned_externals,
                          const apr_hash_t *externals_to_pin,
                          svn_client__copy_pair_t *pair,
                          svn_ra_session_t *ra_session,
@@ -576,7 +590,7 @@ resolve_pinned_externals(apr_hash_t **ne
   apr_hash_index_t *hi;
   apr_pool_t *iterpool;
 
-  *new_externals = apr_hash_make(result_pool);
+  *pinned_externals = apr_hash_make(result_pool);
 
   if (svn_path_is_url(pair->src_abspath_or_url))
     {
@@ -638,15 +652,19 @@ resolve_pinned_externals(apr_hash_t **ne
                                  externals_to_pin,
                                  repos_root_url, local_abspath_or_url, ctx,
                                  result_pool, iterpool));
-      if (svn_path_is_url(pair->src_abspath_or_url))
-        relpath = svn_uri_skip_ancestor(pair->src_abspath_or_url,
-                                        local_abspath_or_url,
-                                        result_pool);
-      else
-        relpath = svn_dirent_skip_ancestor(pair->src_abspath_or_url,
-                                           local_abspath_or_url);
-      SVN_ERR_ASSERT(relpath);
-      svn_hash_sets(*new_externals, relpath, new_propval);
+      if (new_propval)
+        {
+          if (svn_path_is_url(pair->src_abspath_or_url))
+            relpath = svn_uri_skip_ancestor(pair->src_abspath_or_url,
+                                            local_abspath_or_url,
+                                            result_pool);
+          else
+            relpath = svn_dirent_skip_ancestor(pair->src_abspath_or_url,
+                                               local_abspath_or_url);
+          SVN_ERR_ASSERT(relpath);
+
+          svn_hash_sets(*pinned_externals, relpath, new_propval);
+        }
     }
   svn_pool_destroy(iterpool);
 

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs/fs-loader.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs/fs-loader.c?rev=1677760&r1=1677759&r2=1677760&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs/fs-loader.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs/fs-loader.c Tue May  5 09:24:27 2015
@@ -139,7 +139,7 @@ load_module(fs_init_func_t *initfunc, co
                                  _("Invalid name for FS type '%s'"),
                                  name);
 
-    libname = apr_psprintf(pool, "libsvn_fs_%s-%d.so.%d",
+    libname = apr_psprintf(pool, "libsvn_fs_%s-" SVN_DSO_SUFFIX_FMT,
                            name, SVN_VER_MAJOR, SVN_SOVERSION);
     funcname = apr_psprintf(pool, "svn_fs_%s__init", name);
 

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/cached_data.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/cached_data.c?rev=1677760&r1=1677759&r2=1677760&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/cached_data.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/cached_data.c Tue May  5 09:24:27 2015
@@ -1709,9 +1709,11 @@ get_combined_window(svn_stringbuf_t **re
       /* Maybe, we've got a PLAIN start representation.  If we do, read
          as much data from it as the needed for the txdelta window's source
          view.
-         Note that BUF / SOURCE may only be NULL in the first iteration. */
+         Note that BUF / SOURCE may only be NULL in the first iteration.
+         Also note that we may have short-cut reading the delta chain --
+         in which case SRC_OPS is 0 and it might not be a PLAIN rep. */
       source = buf;
-      if (source == NULL && rb->src_state != NULL)
+      if (source == NULL && rb->src_state != NULL && window->src_ops)
         SVN_ERR(read_plain_window(&source, rb->src_state, window->sview_len,
                                   pool, iterpool));
 

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/transaction.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/transaction.c?rev=1677760&r1=1677759&r2=1677760&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/transaction.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/transaction.c Tue May  5 09:24:27 2015
@@ -2218,8 +2218,7 @@ get_shared_rep(representation_t **old_re
       /* Make the problem show up in the server log.
 
          Because not sharing reps is always a save option,
-         completely terminating the server process would
-         be inappropriate.
+         terminating the request would be inappropriate.
        */
       svn_checksum_t checksum;
       checksum.digest = rep->sha1_digest;

Modified: subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c?rev=1677760&r1=1677759&r2=1677760&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c Tue May  5 09:24:27 2015
@@ -146,7 +146,7 @@ load_ra_module(svn_ra__init_func_t *func
     const char *compat_funcname;
     apr_status_t status;
 
-    libname = apr_psprintf(pool, "libsvn_ra_%s-%d.so.%d",
+    libname = apr_psprintf(pool, "libsvn_ra_%s-" SVN_DSO_SUFFIX_FMT,
                            ra_name, SVN_VER_MAJOR, SVN_SOVERSION);
     funcname = apr_psprintf(pool, "svn_ra_%s__init", ra_name);
     compat_funcname = apr_psprintf(pool, "svn_ra_%s_init", ra_name);

Modified: subversion/branches/move-tracking-2/subversion/libsvn_ra_local/ra_plugin.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_ra_local/ra_plugin.c?rev=1677760&r1=1677759&r2=1677760&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_ra_local/ra_plugin.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_ra_local/ra_plugin.c Tue May  5 09:24:27 2015
@@ -41,6 +41,7 @@
 #include "private/svn_repos_private.h"
 #include "private/svn_fspath.h"
 #include "private/svn_atomic.h"
+#include "private/svn_subr_private.h"
 
 #define APR_WANT_STRFUNC
 #include <apr_want.h>
@@ -2070,8 +2071,8 @@ svn_ra_local__init(const svn_version_t *
   SVN_ERR(svn_ver_check_list2(ra_local_version(), checklist, svn_ver_equal));
 
 #ifndef SVN_LIBSVN_CLIENT_LINKS_RA_LOCAL
-  /* This assumes that POOL was the pool used to load the dso. */
-  SVN_ERR(svn_fs_initialize(pool));
+  /* This means the library was loaded as a DSO, so use the DSO pool. */
+  SVN_ERR(svn_fs_initialize(svn_dso__pool()));
 #endif
 
   *vtable = &ra_local_vtable;

Modified: subversion/branches/move-tracking-2/subversion/libsvn_subr/checksum.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_subr/checksum.c?rev=1677760&r1=1677759&r2=1677760&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_subr/checksum.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_subr/checksum.c Tue May  5 09:24:27 2015
@@ -80,6 +80,14 @@ static const apr_size_t digest_sizes[] =
   sizeof(apr_uint32_t)
 };
 
+/* Checksum type prefixes used in serialized checksums. */
+static const char *ckind_str[] = {
+  "$md5 $",
+  "$sha1$",
+  "$fnv1$",
+  "$fnvm$",
+};
+
 /* Returns the digest size of it's argument. */
 #define DIGESTSIZE(k) \
   (((k) < svn_checksum_md5 || (k) > svn_checksum_fnv1a_32x4) ? 0 : digest_sizes[k])
@@ -317,13 +325,10 @@ svn_checksum_serialize(const svn_checksu
                        apr_pool_t *result_pool,
                        apr_pool_t *scratch_pool)
 {
-  const char *ckind_str;
-
   SVN_ERR_ASSERT_NO_RETURN(checksum->kind >= svn_checksum_md5
                            || checksum->kind <= svn_checksum_fnv1a_32x4);
-  ckind_str = (checksum->kind == svn_checksum_md5 ? "$md5 $" : "$sha1$");
   return apr_pstrcat(result_pool,
-                     ckind_str,
+                     ckind_str[checksum->kind],
                      svn_checksum_to_cstring(checksum, scratch_pool),
                      SVN_VA_NULL);
 }
@@ -335,18 +340,26 @@ svn_checksum_deserialize(const svn_check
                          apr_pool_t *result_pool,
                          apr_pool_t *scratch_pool)
 {
-  svn_checksum_kind_t ckind;
+  svn_checksum_kind_t kind;
   svn_checksum_t *parsed_checksum;
 
-  /* "$md5 $..." or "$sha1$..." */
-  SVN_ERR_ASSERT(strlen(data) > 6);
+  /* All prefixes have the same length. */
+  apr_size_t prefix_len = strlen(ckind_str[0]);
 
-  ckind = (data[1] == 'm' ? svn_checksum_md5 : svn_checksum_sha1);
-  SVN_ERR(svn_checksum_parse_hex(&parsed_checksum, ckind,
-                                 data + 6, result_pool));
-  *checksum = parsed_checksum;
+  /* "$md5 $...", "$sha1$..." or ... */
+  SVN_ERR_ASSERT(strlen(data) > prefix_len);
 
-  return SVN_NO_ERROR;
+  for (kind = svn_checksum_md5; kind <= svn_checksum_fnv1a_32x4; ++kind)
+    if (strncmp(ckind_str[kind], data, prefix_len) == 0)
+      {
+        SVN_ERR(svn_checksum_parse_hex(&parsed_checksum, kind,
+                                       data + prefix_len, result_pool));
+        *checksum = parsed_checksum;
+        return SVN_NO_ERROR;
+      }
+
+  return svn_error_createf(SVN_ERR_BAD_CHECKSUM_KIND, NULL,
+                           "Unknown checksum kind in '%s'", data);
 }
 
 

Modified: subversion/branches/move-tracking-2/subversion/libsvn_subr/dso.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_subr/dso.c?rev=1677760&r1=1677759&r2=1677760&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_subr/dso.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_subr/dso.c Tue May  5 09:24:27 2015
@@ -28,6 +28,7 @@
 
 #include "private/svn_mutex.h"
 #include "private/svn_atomic.h"
+#include "private/svn_subr_private.h"
 
 /* A mutex to protect our global pool and cache. */
 static svn_mutex__t *dso_mutex = NULL;
@@ -122,4 +123,11 @@ svn_dso_load(apr_dso_handle_t **dso, con
 
   return SVN_NO_ERROR;
 }
+
+apr_pool_t *
+svn_dso__pool(void)
+{
+  return dso_pool;
+}
+
 #endif /* APR_HAS_DSO */

Modified: subversion/branches/move-tracking-2/subversion/libsvn_subr/stream.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_subr/stream.c?rev=1677760&r1=1677759&r2=1677760&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_subr/stream.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_subr/stream.c Tue May  5 09:24:27 2015
@@ -2200,11 +2200,11 @@ svn_stream__install_stream(svn_stream_t
 
       apr_os_file_get(&hFile, ib->baton_apr.file);
 
-      SVN_ERR(svn_utf__win32_utf8_to_utf16(&w_final_abspath,
-                                           svn_dirent_local_style(
+      SVN_ERR(svn_io__utf8_to_unicode_longpath(&w_final_abspath,
+                                               svn_dirent_local_style(
                                                           final_abspath,
                                                           scratch_pool),
-                                           NULL, scratch_pool));
+                                               scratch_pool));
       path_len = wcslen(w_final_abspath);
       rename_size = sizeof(*rename_info) + sizeof(WCHAR) * path_len;
 

Modified: subversion/branches/move-tracking-2/subversion/tests/libsvn_client/client-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/tests/libsvn_client/client-test.c?rev=1677760&r1=1677759&r2=1677760&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/tests/libsvn_client/client-test.c (original)
+++ subversion/branches/move-tracking-2/subversion/tests/libsvn_client/client-test.c Tue May  5 09:24:27 2015
@@ -1310,11 +1310,15 @@ test_copy_pin_externals_select_subtree(c
     const char *src_external_desc;
     const char *expected_dst_external_desc;
   } test_data[] = {
+    /* Note: these externals definitions contain extra whitespace on
+       purpose, to test that the pinning logic doesn't make
+       whitespace-only changes to values that aren't pinned. */
+
     /* External on A/B will be pinned. */
-    { "B", "^/A/D/gamma gamma-ext", "^/A/D/gamma@3 gamma-ext" },
+    { "B", "^/A/D/gamma  gamma-ext", "^/A/D/gamma@3 gamma-ext" },
 
     /* External on A/D won't be pinned. */
-    { "D", "^/A/B/F F-ext", "^/A/B/F F-ext" } ,
+    { "D", "^/A/B/F  F-ext", "^/A/B/F  F-ext" } ,
 
     { NULL },
   };

Modified: subversion/branches/move-tracking-2/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c?rev=1677760&r1=1677759&r2=1677760&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c (original)
+++ subversion/branches/move-tracking-2/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c Tue May  5 09:24:27 2015
@@ -1538,6 +1538,115 @@ rep_sharing_effectiveness(const svn_test
 
 #undef REPO_NAME
 
+/* ------------------------------------------------------------------------ */
+
+#define REPO_NAME "test-repo-delta_chain_with_plain"
+
+static svn_error_t *
+delta_chain_with_plain(const svn_test_opts_t *opts,
+                       apr_pool_t *pool)
+{
+  svn_fs_t *fs;
+  fs_fs_data_t *ffd;
+  svn_fs_txn_t *txn;
+  svn_fs_root_t *root;
+  svn_revnum_t rev;
+  svn_stringbuf_t *prop_value, *contents, *contents2, *hash_rep;
+  int i;
+  apr_hash_t *fs_config, *props;
+
+  if (strcmp(opts->fs_type, "fsfs") != 0)
+    return svn_error_create(SVN_ERR_TEST_SKIPPED, NULL, NULL);
+
+  /* Reproducing issue #4577 without the r1676667 fix is much harder in 1.9+
+   * than it was in 1.8.  The reason is that 1.9+ won't deltify small reps
+   * nor against small reps.  So, we must construct relatively large PLAIN
+   * and DELTA reps.
+   *
+   * The idea is to construct a PLAIN prop rep, make a file share that as
+   * its text rep, grow the file considerably (to make the PLAIN rep later
+   * read beyond EOF) and then replace it entirely with another longish
+   * contents.
+   */
+
+  /* Create a repo that and explicitly enable rep sharing. */
+  SVN_ERR(svn_test__create_fs(&fs, REPO_NAME, opts, pool));
+
+  ffd = fs->fsap_data;
+  if (ffd->format < SVN_FS_FS__MIN_REP_SHARING_FORMAT)
+    return svn_error_create(SVN_ERR_TEST_SKIPPED, NULL, NULL);
+
+  ffd->rep_sharing_allowed = TRUE;
+
+  /* Make sure all props are stored as PLAIN reps. */
+  ffd->deltify_properties = FALSE;
+
+  /* Construct various content strings.
+   * Note that props need to be shorter than the file contents. */
+  prop_value = svn_stringbuf_create("prop", pool);
+  for (i = 0; i < 10; ++i)
+    svn_stringbuf_appendstr(prop_value, prop_value);
+
+  contents = svn_stringbuf_create("Some text.", pool);
+  for (i = 0; i < 10; ++i)
+    svn_stringbuf_appendstr(contents, contents);
+
+  contents2 = svn_stringbuf_create("Totally new!", pool);
+  for (i = 0; i < 10; ++i)
+    svn_stringbuf_appendstr(contents2, contents2);
+
+  /* Revision 1: create a property rep. */
+  SVN_ERR(svn_fs_begin_txn(&txn, fs, 0, pool));
+  SVN_ERR(svn_fs_txn_root(&root, txn, pool));
+  SVN_ERR(svn_fs_change_node_prop(root, "/", "p",
+                                  svn_string_create(prop_value->data, pool),
+                                  pool));
+  SVN_ERR(svn_fs_commit_txn(NULL, &rev, txn, pool));
+
+  /* Revision 2: create a file that shares the text rep with the PLAIN
+   * property rep from r1. */
+  props = apr_hash_make(pool);
+  svn_hash_sets(props, "p", svn_string_create(prop_value->data, pool));
+
+  hash_rep = svn_stringbuf_create_empty(pool);
+  svn_hash_write2(props, svn_stream_from_stringbuf(hash_rep, pool), "END",
+                  pool);
+
+  SVN_ERR(svn_fs_begin_txn(&txn, fs, rev, pool));
+  SVN_ERR(svn_fs_txn_root(&root, txn, pool));
+  SVN_ERR(svn_fs_make_file(root, "foo", pool));
+  SVN_ERR(svn_test__set_file_contents(root, "foo", hash_rep->data, pool));
+  SVN_ERR(svn_fs_commit_txn(NULL, &rev, txn, pool));
+
+  /* Revision 3: modify the file contents to a long-ish full text
+   * (~10kByte, longer than the r1 revision file). */
+  SVN_ERR(svn_fs_begin_txn(&txn, fs, rev, pool));
+  SVN_ERR(svn_fs_txn_root(&root, txn, pool));
+  SVN_ERR(svn_test__set_file_contents(root, "foo", contents->data, pool));
+  SVN_ERR(svn_fs_commit_txn(NULL, &rev, txn, pool));
+
+  /* Revision 4: replace file contents to something disjoint from r3. */
+  SVN_ERR(svn_fs_begin_txn(&txn, fs, rev, pool));
+  SVN_ERR(svn_fs_txn_root(&root, txn, pool));
+  SVN_ERR(svn_test__set_file_contents(root, "foo", contents2->data, pool));
+  SVN_ERR(svn_fs_commit_txn(NULL, &rev, txn, pool));
+
+  /* Getting foo@4 must work.  To make sure we actually read from disk,
+   * use a new FS instance with disjoint caches. */
+  fs_config = apr_hash_make(pool);
+  svn_hash_sets(fs_config, SVN_FS_CONFIG_FSFS_CACHE_NS,
+                           svn_uuid_generate(pool));
+  SVN_ERR(svn_fs_open2(&fs, REPO_NAME, fs_config, pool, pool));
+
+  SVN_ERR(svn_fs_revision_root(&root, fs, rev, pool));
+  SVN_ERR(svn_test__get_file_contents(root, "foo", &contents, pool));
+  SVN_TEST_STRING_ASSERT(contents->data, contents2->data);
+
+  return SVN_NO_ERROR;
+}
+
+#undef REPO_NAME
+
 
 /* The test table.  */
 
@@ -1584,6 +1693,8 @@ static struct svn_test_descriptor_t test
                        "file with 0 expanded-length, issue #4554"),
     SVN_TEST_OPTS_PASS(rep_sharing_effectiveness,
                        "rep-sharing effectiveness"),
+    SVN_TEST_OPTS_PASS(delta_chain_with_plain,
+                       "delta chains starting with PLAIN, issue #4577"),
     SVN_TEST_NULL
   };
 

Modified: subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/checksum-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/checksum-test.c?rev=1677760&r1=1677759&r2=1677760&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/checksum-test.c (original)
+++ subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/checksum-test.c Tue May  5 09:24:27 2015
@@ -287,6 +287,26 @@ zlib_expansion_test(const svn_test_opts_
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+test_serialization(apr_pool_t *pool)
+{
+  svn_checksum_kind_t kind;
+  for (kind = svn_checksum_md5; kind <= svn_checksum_fnv1a_32x4; ++kind)
+    {
+      const svn_checksum_t *parsed_checksum;
+      svn_checksum_t *checksum = svn_checksum_empty_checksum(kind, pool);
+      const char *serialized = svn_checksum_serialize(checksum, pool, pool);
+
+      SVN_ERR(svn_checksum_deserialize(&parsed_checksum, serialized, pool,
+                                       pool));
+
+      SVN_TEST_ASSERT(parsed_checksum->kind == kind);
+      SVN_TEST_ASSERT(svn_checksum_match(checksum, parsed_checksum));
+    }
+
+  return SVN_NO_ERROR;
+}
+
 /* An array of all test functions */
 
 static int max_threads = 1;
@@ -306,6 +326,8 @@ static struct svn_test_descriptor_t test
                        "zlib expansion test (zlib regression)"),
     SVN_TEST_PASS2(zero_cross_match,
                    "zero checksum cross-type matching"),
+    SVN_TEST_PASS2(test_serialization,
+                   "checksum (de-)serialization"),
     SVN_TEST_NULL
   };
 

Modified: subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/io-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/io-test.c?rev=1677760&r1=1677759&r2=1677760&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/io-test.c (original)
+++ subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/io-test.c Tue May  5 09:24:27 2015
@@ -30,8 +30,10 @@
 
 #include "svn_pools.h"
 #include "svn_string.h"
+#include "svn_io.h"
 #include "private/svn_skel.h"
 #include "private/svn_dep_compat.h"
+#include "private/svn_io_private.h"
 
 #include "../svn_test.h"
 #include "../svn_test_fs.h"
@@ -737,6 +739,49 @@ ignore_enoent(apr_pool_t *pool)
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+test_install_stream_to_longpath(apr_pool_t *pool)
+{
+  const char *tmp_dir;
+  const char *final_abspath;
+  const char *deep_dir;
+  svn_stream_t *stream;
+  svn_stringbuf_t *actual_content;
+  int i;
+
+  /* Create an empty directory. */
+  SVN_ERR(svn_dirent_get_absolute(&tmp_dir, "test_install_stream_to_longpath",
+                                  pool));
+  SVN_ERR(svn_io_remove_dir2(tmp_dir, TRUE, NULL, NULL, pool));
+  SVN_ERR(svn_io_make_dir_recursively(tmp_dir, pool));
+  svn_test_add_dir_cleanup(tmp_dir);
+
+  deep_dir = tmp_dir;
+
+  /* Generate very long path (> 260 symbols) */
+  for (i = 0; i < 26; i++)
+    {
+      deep_dir = svn_dirent_join(deep_dir, "1234567890", pool);
+      SVN_ERR(svn_io_make_dir_recursively(deep_dir, pool));
+    }
+
+  final_abspath = svn_dirent_join(deep_dir, "stream1", pool);
+  SVN_ERR(svn_stream__create_for_install(&stream, deep_dir, pool, pool));
+  SVN_ERR(svn_stream_puts(stream, "stream1 content"));
+  SVN_ERR(svn_stream_close(stream));
+  SVN_ERR(svn_stream__install_stream(stream,
+                                     final_abspath,
+                                     TRUE,
+                                     pool));
+
+  SVN_ERR(svn_stringbuf_from_file2(&actual_content,
+                                   final_abspath,
+                                   pool));
+
+  SVN_TEST_STRING_ASSERT(actual_content->data, "stream1 content");
+
+  return SVN_NO_ERROR;
+}
 
 /* The test table.  */
 
@@ -759,6 +804,8 @@ static struct svn_test_descriptor_t test
                    "test aligned seek"),
     SVN_TEST_PASS2(ignore_enoent,
                    "test ignore-enoent"),
+    SVN_TEST_PASS2(test_install_stream_to_longpath,
+                   "test svn_stream__install_stream to long path"),
     SVN_TEST_NULL
   };