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

svn commit: r1539236 - in /subversion/branches/javahl-1.8-extensions: ./ subversion/bindings/javahl/ subversion/bindings/javahl/native/ subversion/bindings/javahl/native/jniwrapper/ subversion/bindings/javahl/src/org/apache/subversion/javahl/ subversio...

Author: brane
Date: Wed Nov  6 04:06:58 2013
New Revision: 1539236

URL: http://svn.apache.org/r1539236
Log:
On the javahl-1.8-extensions branch: Sync JavaHL with trunk up to r1539232.

Added:
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/ExternalItem.cpp
      - copied unchanged from r1539232, subversion/trunk/subversion/bindings/javahl/native/ExternalItem.cpp
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/ExternalItem.hpp
      - copied unchanged from r1539232, subversion/trunk/subversion/bindings/javahl/native/ExternalItem.hpp
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/SubversionException.cpp
      - copied unchanged from r1539232, subversion/trunk/subversion/bindings/javahl/native/SubversionException.cpp
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/SubversionException.hpp
      - copied unchanged from r1539232, subversion/trunk/subversion/bindings/javahl/native/SubversionException.hpp
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/
      - copied from r1539232, subversion/trunk/subversion/bindings/javahl/native/jniwrapper/
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_PropLib.cpp
      - copied unchanged from r1539232, subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_PropLib.cpp
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/types/ExternalItem.java
      - copied unchanged from r1539232, subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/types/ExternalItem.java
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/PropLib.java
      - copied unchanged from r1539232, subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/PropLib.java
Modified:
    subversion/branches/javahl-1.8-extensions/build.conf
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/   (props changed)
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/JNIUtil.cpp
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/Revision.h
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNUtil.java
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/types/Revision.java
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/DiffLib.java
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/UtilTests.java

Modified: subversion/branches/javahl-1.8-extensions/build.conf
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/build.conf?rev=1539236&r1=1539235&r2=1539236&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/build.conf (original)
+++ subversion/branches/javahl-1.8-extensions/build.conf Wed Nov  6 04:06:58 2013
@@ -40,6 +40,8 @@ private-includes =
         subversion/libsvn_delta/compose_delta.c
         subversion/bindings/cxxhl/include/*.hpp
         subversion/bindings/cxxhl/include/svncxxhl/*.hpp
+        subversion/bindings/javahl/native/*.hpp
+        subversion/bindings/javahl/native/jniwrapper/jni_*.hpp
 private-built-includes =
         subversion/svn_private_config.h
         subversion/libsvn_fs_fs/rep-cache-db.h
@@ -72,6 +74,7 @@ private-built-includes =
         subversion/bindings/javahl/include/org_apache_subversion_javahl_util_ConfigImpl_Category.h
         subversion/bindings/javahl/include/org_apache_subversion_javahl_util_ConfigLib.h
         subversion/bindings/javahl/include/org_apache_subversion_javahl_util_DiffLib.h
+        subversion/bindings/javahl/include/org_apache_subversion_javahl_util_PropLib.h
 
 test-scripts =
         subversion/tests/cmdline/*_tests.py
@@ -652,7 +655,7 @@ type = lib
 path = subversion/bindings/javahl/native
 libs = libsvn_repos libsvn_client libsvn_wc libsvn_ra libsvn_delta libsvn_diff 
        libsvn_subr libsvn_fs aprutil apriconv apr
-sources = *.cpp *.c
+sources = *.cpp jniwrapper/*.cpp
 add-deps = $(javahl_java_DEPS) $(javahl_callback_javah_DEPS)
            $(javahl_remote_javah_DEPS) $(javahl_types_javah_DEPS)
            $(javahl_util_javah_DEPS) $(javahl_javah_DEPS)

Propchange: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/
------------------------------------------------------------------------------
  Merged /subversion/trunk/subversion/bindings/javahl:r1537597-1539232

Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/JNIUtil.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/JNIUtil.cpp?rev=1539236&r1=1539235&r2=1539236&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/JNIUtil.cpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/JNIUtil.cpp Wed Nov  6 04:06:58 2013
@@ -72,6 +72,8 @@ extern "C" {
 #include "Pool.h"
 
 
+#include "jniwrapper/jni_env.hpp"
+
 // Static members of JNIUtil are allocated here.
 apr_pool_t *JNIUtil::g_pool = NULL;
 std::list<SVNBase*> JNIUtil::g_finalizedObjects;
@@ -84,34 +86,13 @@ JNIEnv *JNIUtil::g_initEnv;
 int JNIUtil::g_logLevel = JNIUtil::noLog;
 std::ofstream JNIUtil::g_logStream;
 
-namespace {
-JavaVM *g_jvm = NULL;
-} // anonymous namespace
-
-extern "C" JNIEXPORT jint JNICALL
-JNI_OnLoad(JavaVM *jvm, void*)
-{
-  g_jvm = jvm;
-  return JNI_VERSION_1_2;
-}
-
-extern "C" JNIEXPORT void JNICALL
-JNI_OnUnload(JavaVM*, void*)
-{}
-
 /**
  * Return the JNI environment to use
  * @return the JNI environment
  */
 JNIEnv *JNIUtil::getEnv()
 {
-  // During init -> look into the global variable.
-  if (g_inInit)
-    return g_initEnv;
-
-  void* penv;
-  g_jvm->GetEnv(&penv, JNI_VERSION_1_2);
-  return static_cast<JNIEnv*>(penv);
+  return Java::Env().get();
 }
 
 /**

Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/Revision.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/Revision.h?rev=1539236&r1=1539235&r2=1539236&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/Revision.h (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/Revision.h Wed Nov  6 04:06:58 2013
@@ -50,6 +50,7 @@ class Revision
    * Make a Revision Java object.
    */
   static jobject makeJRevision(svn_revnum_t rev);
+  static jobject makeJRevision(const svn_opt_revision_t& rev);
 };
 
 #endif // REVISION_H

Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNUtil.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNUtil.java?rev=1539236&r1=1539235&r2=1539236&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNUtil.java (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNUtil.java Wed Nov  6 04:06:58 2013
@@ -24,9 +24,12 @@
 package org.apache.subversion.javahl;
 
 import org.apache.subversion.javahl.callback.*;
+import org.apache.subversion.javahl.types.*;
 import org.apache.subversion.javahl.util.*;
 
+import java.io.InputStream;
 import java.io.OutputStream;
+import java.util.List;
 
 public class SVNUtil
 {
@@ -281,4 +284,121 @@ public class SVNUtil
                                        conflictLatest, conflictSeparator,
                                        conflictStyle, resultStream);
     }
+
+    //
+    // Property validation and parsing
+    //
+
+    /**
+     * Validate the value of an <code>svn:</code> property on file or
+     * directory and return a canonical representation of its value.
+     * @param name The name of the property (must be a valid svn: property)
+     * @param value The property's value
+     * @param path The path or URL of the file or directory that
+     *        owns the property; only used for error messages
+     * @param kind The node kind of the file or dir that owns the property
+     * @param mimeType If <code>kind</code> is {@link NodeKind.file}, this is
+     *        tye file's mime-type, used for extra validation for the
+     *        <code>svn:eol-style</code> property. If it is <code>null</code>,
+     *        the extra validation will be skipped.
+     * @return a canonicalized representation of the property value
+     * @see http://subversion.apache.org/docs/api/latest/group__svn__wc__properties.html#ga83296313ec59cc825176224ac8282ec2
+     */
+    public static byte[] canonicalizeNodeProperty(
+        String name, byte[] value, String path, NodeKind kind,
+        String mimeType)
+        throws ClientException
+    {
+        return new PropLib().canonicalizeNodeProperty(
+            name, value, path, kind, mimeType, null);
+    }
+
+    /**
+     * Validate the value of an <code>svn:</code> property on file or
+     * directory and return a canonical representation of its value.
+     * @param name The name of the property (must be a valid svn: property)
+     * @param value The property's value
+     * @param path The path or URL of the file or directory that
+     *        owns the property; only used for error messages
+     * @param kind The node kind of the file or dir that owns the property
+     * @param mimeType If <code>kind</code> is {@link NodeKind.file}, this is
+     *        tye file's mime-type, used for extra validation for the
+     *        <code>svn:eol-style</code> property. If it is <code>null</code>,
+     *        the extra validation will be skipped.
+     * @param fileContents A stream with the file's contents. Only used
+     *        to check for line-ending consistency when validating the
+     *        <code>svn:eol-style</code> property, and only when
+     *        <code>kind</code> is {@link NodeKind.file} and
+     *        <code>mimeType</code> is not <code>null</code>.
+     * @return a canonicalized representation of the property value
+     * @see http://subversion.apache.org/docs/api/latest/group__svn__wc__properties.html#ga83296313ec59cc825176224ac8282ec2
+     */
+    public static byte[] canonicalizeNodeProperty(
+        String name, byte[] value, String path, NodeKind kind,
+        String mimeType, InputStream fileContents)
+        throws ClientException
+    {
+        return new PropLib().canonicalizeNodeProperty(
+            name, value, path, kind, mimeType, fileContents);
+    }
+
+    /**
+     * Parse <code>description</code>, assuming it is an externals
+     * specification in the format required for the
+     * <code>svn:externals</code> property, and return a list of
+     * parsed external items.
+     * @param description The externals description.
+     * @param parentDirectory Used to construct error messages.
+     * @param canonicalizeUrl Whe <code>true</code>, canonicalize the
+     *     <code>url</code> member of the returned objects. If the
+     *     <code>url</code> member refers to an absolute URL, it will
+     *     be canonicalized as URL consistent with the way URLs are
+     *     canonicalized throughout the Subversion API. If, however,
+     *     the <code>url</code> member makes use of the recognized
+     *     (SVN-specific) relative URL syntax for
+     *     <code>svn:externals</code>, "canonicalization" is an
+     *     ill-defined concept which may even result in munging the
+     *     relative URL syntax beyond recognition. You've been warned.
+     * @return a list of {@link ExternalItem}s
+     */
+    public static List<ExternalItem> parseExternals(byte[] description,
+                                                    String parentDirectory,
+                                                    boolean canonicalizeUrl)
+        throws ClientException
+    {
+        return new PropLib().parseExternals(description, parentDirectory,
+                                            canonicalizeUrl);
+    }
+
+    /**
+     * Unparse and list of external items into a format suitable for
+     * the value of the <code>svn:externals</code> property and
+     * validate the result.
+     * @param items The list of {@link ExternalItem}s
+     * @param parentDirectory Used to construct error messages.
+     * @param compatibleWithSvn1_5 When <code>true</code>, the format
+     *     of the returned property value will be compatible with
+     *     clients older than Subversion 1.5.
+     */
+    public static byte[] unparseExternals(List<ExternalItem> items,
+                                          String parentDirectory)
+        throws SubversionException
+    {
+        return new PropLib().unparseExternals(items, parentDirectory, false);
+    }
+
+    /**
+     * Unparse and list of external items into a format suitable for
+     * the value of the <code>svn:externals</code> property compatible
+     * with Subversion clients older than release 1.5, and validate
+     * the result.
+     * @param items The list of {@link ExternalItem}s
+     * @param parentDirectory Used to construct error messages.
+     */
+    public static byte[] unparseExternalsForAncientUnsupportedClients(
+        List<ExternalItem> items, String parentDirectory)
+        throws SubversionException
+    {
+        return new PropLib().unparseExternals(items, parentDirectory, true);
+    }
 }

Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/types/Revision.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/types/Revision.java?rev=1539236&r1=1539235&r2=1539236&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/types/Revision.java (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/types/Revision.java Wed Nov  6 04:06:58 2013
@@ -277,6 +277,16 @@ public class Revision implements java.io
                 throw new IllegalArgumentException("a date must be specified");
             revDate = date;
         }
+
+        /**
+         * Create a revision from a timestamp in milliseconds.
+         * Used by the native implementaiton.
+         */
+        private DateSpec(long milliseconds)
+        {
+            this(new Date(milliseconds));
+        }
+
         /**
          * Returns the date of the revision
          * @return the date
@@ -316,7 +326,6 @@ public class Revision implements java.io
         {
             return revDate.hashCode();
         }
-
     }
 
     /**

Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/DiffLib.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/DiffLib.java?rev=1539236&r1=1539235&r2=1539236&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/DiffLib.java (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/DiffLib.java Wed Nov  6 04:06:58 2013
@@ -43,7 +43,7 @@ public class DiffLib
         NativeResources.loadNativeLibrary();
     }
 
-    /** @see ISVNUtil.fileDiff */
+    /** @see SVNUtil.fileDiff */
     public boolean fileDiff(String originalFile,
                             String modifiedFile,
                             SVNUtil.DiffOptions diffOptions,
@@ -88,7 +88,7 @@ public class DiffLib
                                OutputStream resultStream)
         throws ClientException;
 
-    /** @see ISVNUtil.fileMerge */
+    /** @see SVNUtil.fileMerge */
     public boolean fileMerge(String originalFile,
                              String modifiedFile,
                              String latestFile,

Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java?rev=1539236&r1=1539235&r2=1539236&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java Wed Nov  6 04:06:58 2013
@@ -3862,6 +3862,7 @@ public class BasicTests extends SVNTests
     {
         public void doChangelist(String path, String changelist)
         {
+            path = fileToSVNPath(new File(path), true);
             if (super.containsKey(path))
             {
                 // Append the changelist to the existing list

Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/UtilTests.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/UtilTests.java?rev=1539236&r1=1539235&r2=1539236&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/UtilTests.java (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/UtilTests.java Wed Nov  6 04:06:58 2013
@@ -23,10 +23,17 @@
 
 package org.apache.subversion.javahl;
 
+import org.apache.subversion.javahl.types.ExternalItem;
+import org.apache.subversion.javahl.types.NodeKind;
+import org.apache.subversion.javahl.types.Revision;
+
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.ByteArrayOutputStream;
 import java.util.Arrays;
+import java.util.List;
+import java.util.ArrayList;
 
 /**
  * Tests the JavaHL SVNUtil APIs.
@@ -135,4 +142,152 @@ public class UtilTests extends SVNTests
                                  "\nN-3\nN-2\nN-1\nN\n").getBytes();
         assertTrue(Arrays.equals(expected, result.toByteArray()));
     }
+
+    public void testValidateProp() throws Throwable
+    {
+        File temp = File.createTempFile("propcheck", ".file", localTmp);
+        FileOutputStream out = new FileOutputStream(temp);
+        out.write("normal text\n".getBytes());
+        out.close();
+
+        byte[] prop = SVNUtil.canonicalizeNodeProperty(
+                           "svn:eol-style", "  native".getBytes(),
+                           "propcheck.file", NodeKind.file,
+                           "text/plain");
+        assertEquals("native", new String(prop));
+
+        prop = SVNUtil.canonicalizeNodeProperty(
+                    "svn:eol-style", " native  ".getBytes(),
+                    "propcheck.file", NodeKind.file,
+                    "text/plain", new FileInputStream(temp));
+        assertEquals("native", new String(prop));
+
+        boolean caught_exception = false;
+        try {
+            prop = SVNUtil.canonicalizeNodeProperty(
+                        "svn:eol-style", " weird  ".getBytes(),
+                        "propcheck.file", NodeKind.file,
+                        "text/plain");
+        } catch (ClientException ex) {
+            assertEquals("Unrecognized line ending style",
+                         ex.getAllMessages().get(0).getMessage());
+            caught_exception = true;
+        }
+        assertTrue(caught_exception);
+
+        out = new FileOutputStream(temp);
+        out.write("inconsistent\r\ntext\n".getBytes());
+        out.close();
+
+        caught_exception = false;
+        try {
+            prop = SVNUtil.canonicalizeNodeProperty(
+                        "svn:eol-style", " native  ".getBytes(),
+                        "propcheck.file", NodeKind.file,
+                        "text/plain", new FileInputStream(temp));
+        } catch (ClientException ex) {
+            assertEquals("Inconsistent line ending style",
+                         ex.getAllMessages().get(2).getMessage());
+            caught_exception = true;
+        }
+        assertTrue(caught_exception);
+    }
+
+
+    private static List<ExternalItem> externals = null;
+    static {
+        try {
+            externals = new ArrayList<ExternalItem>(20);
+            externals.add(new ExternalItem("a", "http://server/repo/path",
+                                           null, null));
+            externals.add(new ExternalItem("b", "//server/repo/path",
+                                           null, null));
+            externals.add(new ExternalItem("c", "/repo/path",
+                                           null, null));
+            externals.add(new ExternalItem("d", "^/path",
+                                           null, null));
+            externals.add(new ExternalItem("e", "^/../oper/path",
+                                           null, null));
+
+            externals.add(new ExternalItem("f", "http://server/repo/path",
+                                           Revision.getInstance(42), null));
+            externals.add(new ExternalItem("g", "//server/repo/path",
+                                           Revision.getInstance(42), null));
+            externals.add(new ExternalItem("h", "/repo/path",
+                                           Revision.getInstance(42), null));
+            externals.add(new ExternalItem("j", "^/path",
+                                           Revision.getInstance(42), null));
+            externals.add(new ExternalItem("j", "^/../oper/path",
+                                           Revision.getInstance(42), null));
+
+            externals.add(new ExternalItem("k", "http://server/repo/path",
+                                           null, Revision.getInstance(42)));
+            externals.add(new ExternalItem("l", "//server/repo/path",
+                                           null, Revision.getInstance(42)));
+            externals.add(new ExternalItem("m", "/repo/path",
+                                           null, Revision.getInstance(42)));
+            externals.add(new ExternalItem("n", "^/path",
+                                           null, Revision.getInstance(42)));
+            externals.add(new ExternalItem("o", "^/../oper/path",
+                                           null, Revision.getInstance(42)));
+
+            externals.add(new ExternalItem("p", "http://server/repo/path",
+                                           Revision.getInstance(69),
+                                           Revision.getInstance(71)));
+            externals.add(new ExternalItem("q", "//server/repo/path",
+                                           Revision.getInstance(69),
+                                           Revision.getInstance(71)));
+            externals.add(new ExternalItem("r", "/repo/path",
+                                           Revision.getInstance(69),
+                                           Revision.getInstance(71)));
+            externals.add(new ExternalItem("s", "^/path",
+                                           Revision.getInstance(69),
+                                           Revision.getInstance(71)));
+            externals.add(new ExternalItem("t", "^/../oper/path",
+                                           Revision.getInstance(69),
+                                           Revision.getInstance(71)));
+        } catch (SubversionException ex) {
+            externals = null;
+            throw new RuntimeException(ex);
+        }
+    }
+
+    public void testUnparseExternals() throws Throwable
+    {
+        byte[] props = SVNUtil.unparseExternals(externals, "dirname");
+        assertEquals(424, props.length);
+    }
+
+    private static List<ExternalItem> old_externals = null;
+    static {
+        try {
+            old_externals = new ArrayList<ExternalItem>(2);
+            old_externals.add(new ExternalItem("X", "http://server/repo/path",
+                                               null, null));
+            old_externals.add(new ExternalItem("Y", "http://server/repo/path",
+                                               Revision.getInstance(42), null));
+        } catch (SubversionException ex) {
+            old_externals = null;
+            throw new RuntimeException(ex);
+        }
+    }
+
+    public void testUnparseExternalsOldstyle() throws Throwable
+    {
+        byte[] props;
+
+        props = SVNUtil.unparseExternalsForAncientUnsupportedClients(
+                     old_externals, "dirname");
+        assertEquals(57, props.length);
+
+        // The fancy new features are not supported in the old format
+        boolean caught_exception = false;
+        try {
+            props = SVNUtil.unparseExternalsForAncientUnsupportedClients(
+                         externals, "dirname");
+        } catch (SubversionException ex) {
+            caught_exception = true;
+        }
+        assertTrue(caught_exception);
+    }
 }