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/06/27 03:16:09 UTC

svn commit: r1497175 - in /subversion/trunk/subversion/bindings/javahl/native: CommitEditor.cpp Path.cpp Path.h RemoteSession.cpp

Author: brane
Date: Thu Jun 27 01:16:08 2013
New Revision: 1497175

URL: http://svn.apache.org/r1497175
Log:
Add relpath and URI parameter canonicalization to the JavaHL RA API.

[in subversion/bindings/javahl/native]
* Path.h (PathBase): Renamed from Path, methods made private.
   Removed bogus "copy" constructor that was not used, and was
   not in fact a copy constructor.
   Added constructor from JNI string.
  (Path, URL, Relpath): New classes for specific type of path
   verification and normalization:
    - Path: a dirent or URI
    - URL: an URI
    - Relpath: a relpath
* Path.cpp: Implement all of the above.

* CommitEditor.cpp, RemoteSession.cpp: Add apropriate URL or relpath
   checks to the native implementations of the RA and editor operaitons.

Modified:
    subversion/trunk/subversion/bindings/javahl/native/CommitEditor.cpp
    subversion/trunk/subversion/bindings/javahl/native/Path.cpp
    subversion/trunk/subversion/bindings/javahl/native/Path.h
    subversion/trunk/subversion/bindings/javahl/native/RemoteSession.cpp

Modified: subversion/trunk/subversion/bindings/javahl/native/CommitEditor.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/CommitEditor.cpp?rev=1497175&r1=1497174&r2=1497175&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/CommitEditor.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/CommitEditor.cpp Thu Jun 27 01:16:08 2013
@@ -292,9 +292,6 @@ void CommitEditor::addDirectory(jstring 
     }
   SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
 
-  JNIStringHolder relpath(jrelpath);
-  if (JNIUtil::isJavaExceptionThrown())
-    return;
   Iterator children(jchildren);
   if (JNIUtil::isJavaExceptionThrown())
     return;
@@ -303,7 +300,12 @@ void CommitEditor::addDirectory(jstring 
     return;
 
   SVN::Pool subPool(pool);
-  SVN_JNI_ERR(svn_editor_add_directory(m_editor, relpath,
+  Relpath relpath(jrelpath, subPool);
+  if (JNIUtil::isExceptionThrown())
+    return;
+  SVN_JNI_ERR(relpath.error_occurred(),);
+
+  SVN_JNI_ERR(svn_editor_add_directory(m_editor, relpath.c_str(),
                                        build_children(children, subPool),
                                        properties.hash(subPool, false),
                                        svn_revnum_t(jreplaces_revision)),);
@@ -321,19 +323,21 @@ void CommitEditor::addFile(jstring jrelp
     }
   SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
 
-  JNIStringHolder relpath(jrelpath);
-  if (JNIUtil::isJavaExceptionThrown())
-    return;
   InputStream contents(jcontents);
   RevpropTable properties(jproperties, true);
   if (JNIUtil::isJavaExceptionThrown())
     return;
 
   SVN::Pool subPool(pool);
+  Relpath relpath(jrelpath, subPool);
+  if (JNIUtil::isExceptionThrown())
+    return;
+  SVN_JNI_ERR(relpath.error_occurred(),);
+
   svn_checksum_t checksum = build_checksum(jchecksum, subPool);
   if (JNIUtil::isJavaExceptionThrown())
     return;
-  SVN_JNI_ERR(svn_editor_add_file(m_editor, relpath,
+  SVN_JNI_ERR(svn_editor_add_file(m_editor, relpath.c_str(),
                                   &checksum, contents.getStream(subPool),
                                   properties.hash(subPool, false),
                                   svn_revnum_t(jreplaces_revision)),);
@@ -356,11 +360,14 @@ void CommitEditor::addAbsent(jstring jre
     }
   SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
 
-  JNIStringHolder relpath(jrelpath);
-  if (JNIUtil::isJavaExceptionThrown())
+  SVN::Pool subPool(pool);
+  Relpath relpath(jrelpath, subPool);
+  if (JNIUtil::isExceptionThrown())
     return;
-  SVN_JNI_ERR(svn_editor_add_absent(m_editor,
-                                    relpath, EnumMapper::toNodeKind(jkind),
+  SVN_JNI_ERR(relpath.error_occurred(),);
+
+  SVN_JNI_ERR(svn_editor_add_absent(m_editor, relpath.c_str(),
+                                    EnumMapper::toNodeKind(jkind),
                                     svn_revnum_t(jreplaces_revision)),);
 }
 
@@ -374,9 +381,6 @@ void CommitEditor::alterDirectory(jstrin
     }
   SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
 
-  JNIStringHolder relpath(jrelpath);
-  if (JNIUtil::isJavaExceptionThrown())
-    return;
   Iterator children(jchildren);
   if (JNIUtil::isJavaExceptionThrown())
     return;
@@ -385,8 +389,13 @@ void CommitEditor::alterDirectory(jstrin
     return;
 
   SVN::Pool subPool(pool);
+  Relpath relpath(jrelpath, subPool);
+  if (JNIUtil::isExceptionThrown())
+    return;
+  SVN_JNI_ERR(relpath.error_occurred(),);
+
   SVN_JNI_ERR(svn_editor_alter_directory(
-                  m_editor, relpath, svn_revnum_t(jrevision),
+                  m_editor, relpath.c_str(), svn_revnum_t(jrevision),
                   (jchildren ? build_children(children, subPool) : NULL),
                   properties.hash(subPool, true)),);
 }
@@ -402,20 +411,22 @@ void CommitEditor::alterFile(jstring jre
     }
   SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
 
-  JNIStringHolder relpath(jrelpath);
-  if (JNIUtil::isJavaExceptionThrown())
-    return;
   InputStream contents(jcontents);
   RevpropTable properties(jproperties, true);
   if (JNIUtil::isJavaExceptionThrown())
     return;
 
   SVN::Pool subPool(pool);
+  Relpath relpath(jrelpath, subPool);
+  if (JNIUtil::isExceptionThrown())
+    return;
+  SVN_JNI_ERR(relpath.error_occurred(),);
+
   svn_checksum_t checksum = build_checksum(jchecksum, subPool);
   if (JNIUtil::isJavaExceptionThrown())
     return;
   SVN_JNI_ERR(svn_editor_alter_file(
-                  m_editor, relpath, svn_revnum_t(jrevision),
+                  m_editor, relpath.c_str(), svn_revnum_t(jrevision),
                   (jcontents ? &checksum : NULL),
                   (jcontents ? contents.getStream(subPool) : NULL),
                   properties.hash(subPool, true)),);
@@ -436,10 +447,14 @@ void CommitEditor::remove(jstring jrelpa
     }
   SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
 
-  JNIStringHolder relpath(jrelpath);
-  if (JNIUtil::isJavaExceptionThrown())
+  SVN::Pool subPool(pool);
+  Relpath relpath(jrelpath, subPool);
+  if (JNIUtil::isExceptionThrown())
     return;
-  SVN_JNI_ERR(svn_editor_delete(m_editor, relpath, svn_revnum_t(jrevision)),);
+  SVN_JNI_ERR(relpath.error_occurred(),);
+
+  SVN_JNI_ERR(svn_editor_delete(m_editor, relpath.c_str(),
+                                svn_revnum_t(jrevision)),);
 }
 
 void CommitEditor::copy(jstring jsrc_relpath, jlong jsrc_revision,
@@ -452,16 +467,21 @@ void CommitEditor::copy(jstring jsrc_rel
     }
   SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
 
-  JNIStringHolder src_relpath(jsrc_relpath);
-  if (JNIUtil::isJavaExceptionThrown())
+  SVN::Pool subPool(pool);
+  Relpath src_relpath(jsrc_relpath, subPool);
+  if (JNIUtil::isExceptionThrown())
     return;
-  JNIStringHolder dst_relpath(jdst_relpath);
-  if (JNIUtil::isJavaExceptionThrown())
+  SVN_JNI_ERR(src_relpath.error_occurred(),);
+  Relpath dst_relpath(jdst_relpath, subPool);
+  if (JNIUtil::isExceptionThrown())
     return;
+  SVN_JNI_ERR(dst_relpath.error_occurred(),);
 
   SVN_JNI_ERR(svn_editor_copy(m_editor,
-                              src_relpath, svn_revnum_t(jsrc_revision),
-                              dst_relpath, svn_revnum_t(jreplaces_revision)),);
+                              src_relpath.c_str(),
+                              svn_revnum_t(jsrc_revision),
+                              dst_relpath.c_str(),
+                              svn_revnum_t(jreplaces_revision)),);
 }
 
 void CommitEditor::move(jstring jsrc_relpath, jlong jsrc_revision,
@@ -474,16 +494,21 @@ void CommitEditor::move(jstring jsrc_rel
     }
   SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
 
-  JNIStringHolder src_relpath(jsrc_relpath);
-  if (JNIUtil::isJavaExceptionThrown())
+  SVN::Pool subPool(pool);
+  Relpath src_relpath(jsrc_relpath, subPool);
+  if (JNIUtil::isExceptionThrown())
     return;
-  JNIStringHolder dst_relpath(jdst_relpath);
-  if (JNIUtil::isJavaExceptionThrown())
+  SVN_JNI_ERR(src_relpath.error_occurred(),);
+  Relpath dst_relpath(jdst_relpath, subPool);
+  if (JNIUtil::isExceptionThrown())
     return;
+  SVN_JNI_ERR(dst_relpath.error_occurred(),);
 
   SVN_JNI_ERR(svn_editor_move(m_editor,
-                              src_relpath, svn_revnum_t(jsrc_revision),
-                              dst_relpath, svn_revnum_t(jreplaces_revision)),);
+                              src_relpath.c_str(),
+                              svn_revnum_t(jsrc_revision),
+                              dst_relpath.c_str(),
+                              svn_revnum_t(jreplaces_revision)),);
 }
 
 void CommitEditor::rotate(jobject jelements)

Modified: subversion/trunk/subversion/bindings/javahl/native/Path.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/Path.cpp?rev=1497175&r1=1497174&r2=1497175&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/Path.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/Path.cpp Thu Jun 27 01:16:08 2013
@@ -27,18 +27,24 @@
 #include <jni.h>
 #include "Path.h"
 #include "svn_path.h"
+#include "svn_dirent_uri.h"
 #include "JNIUtil.h"
+#include "JNIStringHolder.h"
 #include "Pool.h"
+#include "svn_private_config.h"
 
 /**
  * Constructor
  *
- * @see Path::Path(const std::string &)
+ * @see PathBase::PathBase(const std::string &)
  * @param path Path string
  */
-Path::Path(const char *pi_path, SVN::Pool &in_pool)
+PathBase::PathBase(const char *pi_path,
+                   svn_error_t* initfunc(const char*&, SVN::Pool&),
+                   SVN::Pool &in_pool)
+  : m_error_occurred(NULL)
 {
-  init(pi_path, in_pool);
+  init(pi_path, initfunc, in_pool);
 }
 
 /**
@@ -48,19 +54,26 @@ Path::Path(const char *pi_path, SVN::Poo
  *
  * @param path Path string
  */
-Path::Path(const std::string &pi_path, SVN::Pool &in_pool)
+PathBase::PathBase(const std::string &pi_path,
+                   svn_error_t* initfunc(const char*&, SVN::Pool&),
+                   SVN::Pool &in_pool)
+  : m_error_occurred(NULL)
 {
-  init(pi_path.c_str(), in_pool);
+  init(pi_path.c_str(), initfunc, in_pool);
 }
 
 /**
- * Copy constructor
- *
- * @param path Path to be copied
+ * Constructor from a Java string.
  */
-Path::Path(const Path &pi_path, SVN::Pool &in_pool)
+PathBase::PathBase(jstring jpath,
+                   svn_error_t* initfunc(const char*&, SVN::Pool&),
+                   SVN::Pool &in_pool)
+  : m_error_occurred(NULL)
 {
-  init(pi_path.c_str(), in_pool);
+  JNIStringHolder path(jpath);
+  if (JNIUtil::isJavaExceptionThrown())
+    return;
+  init(path, initfunc, in_pool);
 }
 
 /**
@@ -69,17 +82,13 @@ Path::Path(const Path &pi_path, SVN::Poo
  * @param path Path string
  */
 void
-Path::init(const char *pi_path, SVN::Pool &in_pool)
+PathBase::init(const char *pi_path,
+               svn_error_t* initfunc(const char*&, SVN::Pool&),
+               SVN::Pool &in_pool)
 {
-  if (*pi_path == 0)
-    {
-      m_error_occurred = NULL;
-      m_path = "";
-    }
-  else
+  if (pi_path && *pi_path)
     {
-      m_error_occurred = JNIUtil::preprocessPath(pi_path, in_pool.getPool());
-
+      m_error_occurred = initfunc(pi_path, in_pool);
       m_path = pi_path;
     }
 }
@@ -88,7 +97,7 @@ Path::init(const char *pi_path, SVN::Poo
  * @return Path string
  */
 const std::string &
-Path::path() const
+PathBase::path() const
 {
   return m_path;
 }
@@ -97,7 +106,7 @@ Path::path() const
  * @return Path string as a C string
  */
 const char *
-Path::c_str() const
+PathBase::c_str() const
 {
   return m_path.c_str();
 }
@@ -105,8 +114,8 @@ Path::c_str() const
 /**
  * Assignment operator
  */
-Path&
-Path::operator=(const Path &pi_path)
+PathBase&
+PathBase::operator=(const PathBase &pi_path)
 {
   m_error_occurred = NULL;
   m_path = pi_path.m_path;
@@ -114,12 +123,12 @@ Path::operator=(const Path &pi_path)
   return *this;
 }
 
-  svn_error_t *Path::error_occurred() const
+svn_error_t *PathBase::error_occurred() const
 {
   return m_error_occurred;
 }
 
-jboolean Path::isValid(const char *p)
+jboolean PathBase::isValid(const char *p)
 {
   if (p == NULL)
     return JNI_FALSE;
@@ -136,3 +145,25 @@ jboolean Path::isValid(const char *p)
       return JNI_FALSE;
     }
 }
+
+svn_error_t*
+Path::initfunc(const char*& path, SVN::Pool& pool)
+{
+  return JNIUtil::preprocessPath(path, pool.getPool());
+}
+
+svn_error_t*
+URL::initfunc(const char*& path, SVN::Pool& pool)
+{
+  if (svn_path_is_url(path))
+    return JNIUtil::preprocessPath(path, pool.getPool());
+  return svn_error_createf(SVN_ERR_BAD_URL, NULL,
+                           _("Not an URL: %s"), path);
+}
+
+svn_error_t*
+Relpath::initfunc(const char*& path, SVN::Pool& pool)
+{
+  path = svn_relpath__internal_style(path, pool.getPool());
+  return SVN_NO_ERROR;
+}

Modified: subversion/trunk/subversion/bindings/javahl/native/Path.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/Path.h?rev=1497175&r1=1497174&r2=1497175&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/Path.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/Path.h Thu Jun 27 01:16:08 2013
@@ -24,18 +24,19 @@
  * @brief Interface of the C++ class Path.
  */
 
-#ifndef PATH_H
-#define PATH_H
+#ifndef JAVAHL_PATH_H
+#define JAVAHL_PATH_H
 
 #include <string>
 #include <jni.h>
 #include "Pool.h"
 struct svn_error_t;
 
+
 /**
  * Encapsulation for Subversion Path handling
  */
-class Path
+class PathBase
 {
  private:
   // The path to be stored.
@@ -48,9 +49,11 @@ class Path
    *
    * @param pi_path Path string
    */
-  void init(const char *pi_path, SVN::Pool &in_pool);
+  void init(const char *pi_path,
+            svn_error_t* initfunc(const char*&, SVN::Pool&),
+            SVN::Pool &in_pool);
 
- public:
+ protected:
   /**
    * Constructor that takes a string as parameter.
    * The string is converted to subversion internal
@@ -58,27 +61,31 @@ class Path
    *
    * @param pi_path Path string
    */
-  Path(const std::string &pi_path, SVN::Pool &in_pool);
+  PathBase(const std::string &pi_path,
+           svn_error_t* initfunc(const char*&, SVN::Pool&),
+           SVN::Pool &in_pool);
 
   /**
    * Constructor
    *
-   * @see Path::Path (const std::string &)
+   * @see PathBase::PathBase (const std::string &)
    * @param pi_path Path string
    */
-  Path(const char *pi_path, SVN::Pool &in_pool);
+  PathBase(const char *pi_path,
+           svn_error_t* initfunc(const char*&, SVN::Pool&),
+           SVN::Pool &in_pool);
 
   /**
-   * Copy constructor
-   *
-   * @param pi_path Path to be copied
+   * Constructor from a Java string.
    */
-  Path(const Path &pi_path, SVN::Pool &in_pool);
+  PathBase(jstring jpath,
+           svn_error_t* initfunc(const char*&, SVN::Pool&),
+           SVN::Pool &in_pool);
 
   /**
    * Assignment operator
    */
-  Path &operator=(const Path&);
+  PathBase &operator=(const PathBase&);
 
   /**
    * @return Path string
@@ -92,6 +99,7 @@ class Path
 
   svn_error_t *error_occurred() const;
 
+public:
   /**
    * Returns whether @a path is non-NULL and passes the @c
    * svn_path_check_valid() test.
@@ -101,4 +109,113 @@ class Path
   static jboolean isValid(const char *path);
 };
 
-#endif  // PATH_H
+
+/**
+ * Dirent or URI
+ */
+class Path : protected PathBase
+{
+ public:
+  Path(const std::string &pi_path, SVN::Pool &in_pool)
+    : PathBase(pi_path, initfunc, in_pool)
+    {}
+
+  Path(const char *pi_path, SVN::Pool &in_pool)
+    : PathBase(pi_path, initfunc, in_pool)
+    {}
+
+  Path(jstring jpath, SVN::Pool &in_pool)
+    : PathBase(jpath, initfunc, in_pool)
+    {}
+
+  Path& operator=(const Path& that)
+    {
+      PathBase::operator=(that);
+      return *this;
+    }
+
+  const std::string &path() const { return PathBase::path(); }
+  const char *c_str() const { return PathBase::c_str(); }
+
+  svn_error_t *error_occurred() const
+    {
+      return PathBase::error_occurred();
+    }
+
+ private:
+  static svn_error_t* initfunc(const char*&, SVN::Pool&);
+};
+
+/**
+ * URL
+ */
+class URL : protected PathBase
+{
+ public:
+  URL(const std::string &pi_path, SVN::Pool &in_pool)
+    : PathBase(pi_path, initfunc, in_pool)
+    {}
+
+  URL(const char *pi_path, SVN::Pool &in_pool)
+    : PathBase(pi_path, initfunc, in_pool)
+    {}
+
+  URL(jstring jpath, SVN::Pool &in_pool)
+    : PathBase(jpath, initfunc, in_pool)
+    {}
+
+  URL& operator=(const URL& that)
+    {
+      PathBase::operator=(that);
+      return *this;
+    }
+
+  const std::string &path() const { return PathBase::path(); }
+  const char *c_str() const { return PathBase::c_str(); }
+
+  svn_error_t *error_occurred() const
+    {
+      return PathBase::error_occurred();
+    }
+
+ private:
+  static svn_error_t* initfunc(const char*&, SVN::Pool&);
+};
+
+/**
+ * Relative path
+ */
+class Relpath : protected PathBase
+{
+ public:
+  Relpath(const std::string &pi_path, SVN::Pool &in_pool)
+    : PathBase(pi_path, initfunc, in_pool)
+    {}
+
+  Relpath(const char *pi_path, SVN::Pool &in_pool)
+    : PathBase(pi_path, initfunc, in_pool)
+    {}
+
+  Relpath(jstring jpath, SVN::Pool &in_pool)
+    : PathBase(jpath, initfunc, in_pool)
+    {}
+
+  Relpath& operator=(const Relpath& that)
+    {
+      PathBase::operator=(that);
+      return *this;
+    }
+
+  const std::string &path() const { return PathBase::path(); }
+  const char *c_str() const { return PathBase::c_str(); }
+
+  svn_error_t *error_occurred() const
+    {
+      return PathBase::error_occurred();
+    }
+
+ private:
+  static svn_error_t* initfunc(const char*&, SVN::Pool&);
+};
+
+#endif  // JAVAHL_PATH_H

Modified: subversion/trunk/subversion/bindings/javahl/native/RemoteSession.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/RemoteSession.cpp?rev=1497175&r1=1497174&r2=1497175&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/RemoteSession.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/RemoteSession.cpp Thu Jun 27 01:16:08 2013
@@ -30,6 +30,7 @@
 #include "JNIByteArray.h"
 #include "JNIStringHolder.h"
 #include "JNIUtil.h"
+#include "Path.h"
 
 #include "svn_ra.h"
 #include "svn_string.h"
@@ -64,9 +65,11 @@ RemoteSession::open(jint jretryAttempts,
 {
   JNIEnv *env = JNIUtil::getEnv();
 
-  JNIStringHolder url(jurl);
+  SVN::Pool requestPool;
+  URL url(jurl, requestPool);
   if (JNIUtil::isExceptionThrown())
     return NULL;
+  SVN_JNI_ERR(url.error_occurred(), NULL);
   env->DeleteLocalRef(jurl);
 
   JNIStringHolder uuid(juuid);
@@ -98,7 +101,7 @@ RemoteSession::open(jint jretryAttempts,
     }
 
   jobject jremoteSession = open(
-      jretryAttempts, url, uuid, configDirectory,
+      jretryAttempts, url.c_str(), uuid, configDirectory,
       usernameStr, passwordStr, prompter, jprogress);
   if (JNIUtil::isExceptionThrown() || !jremoteSession)
     {
@@ -279,12 +282,13 @@ RemoteSession::dispose(jobject jthis)
 
 void RemoteSession::reparent(jstring jurl)
 {
-  JNIStringHolder url(jurl);
-  if (JNIUtil::isJavaExceptionThrown())
+  SVN::Pool subPool(pool);
+  URL url(jurl, subPool);
+  if (JNIUtil::isExceptionThrown())
     return;
+  SVN_JNI_ERR(url.error_occurred(),);
 
-  SVN::Pool subPool(pool);
-  SVN_JNI_ERR(svn_ra_reparent(m_session, url, subPool.getPool()), );
+  SVN_JNI_ERR(svn_ra_reparent(m_session, url.c_str(), subPool.getPool()), );
 }
 
 jstring
@@ -304,14 +308,15 @@ RemoteSession::getSessionUrl()
 jstring
 RemoteSession::getSessionRelativePath(jstring jurl)
 {
-  JNIStringHolder url(jurl);
-  if (JNIUtil::isJavaExceptionThrown())
+  SVN::Pool subPool(pool);
+  URL url(jurl, subPool);
+  if (JNIUtil::isExceptionThrown())
     return NULL;
+  SVN_JNI_ERR(url.error_occurred(), NULL);
 
-  SVN::Pool subPool(pool);
   const char* rel_path;
   SVN_JNI_ERR(svn_ra_get_path_relative_to_session(
-                  m_session, &rel_path, url, subPool.getPool()),
+                  m_session, &rel_path, url.c_str(), subPool.getPool()),
               NULL);
   jstring jrel_path = JNIUtil::makeJString(rel_path);
   if (JNIUtil::isJavaExceptionThrown())
@@ -323,13 +328,15 @@ RemoteSession::getSessionRelativePath(js
 jstring
 RemoteSession::getReposRelativePath(jstring jurl)
 {
-  JNIStringHolder url(jurl);
-  if (JNIUtil::isJavaExceptionThrown())
+  SVN::Pool subPool(pool);
+  URL url(jurl, subPool);
+  if (JNIUtil::isExceptionThrown())
     return NULL;
+  SVN_JNI_ERR(url.error_occurred(), NULL);
 
-  SVN::Pool subPool(pool);
   const char* rel_path;
-  SVN_JNI_ERR(svn_ra_get_path_relative_to_root(m_session, &rel_path, url,
+  SVN_JNI_ERR(svn_ra_get_path_relative_to_root(m_session, &rel_path,
+                                               url.c_str(),
                                                subPool.getPool()),
               NULL);
 
@@ -470,21 +477,22 @@ jlong
 RemoteSession::getFile(jlong jrevision, jstring jpath,
                        jobject jcontents, jobject jproperties)
 {
-  JNIStringHolder path(jpath);
+  OutputStream contents_proxy(jcontents);
   if (JNIUtil::isExceptionThrown())
     return SVN_INVALID_REVNUM;
 
-  OutputStream contents_proxy(jcontents);
+  SVN::Pool subPool(pool);
+  Relpath path(jpath, subPool);
   if (JNIUtil::isExceptionThrown())
     return SVN_INVALID_REVNUM;
+  SVN_JNI_ERR(path.error_occurred(), SVN_INVALID_REVNUM);
 
-  SVN::Pool subPool(pool);
   apr_hash_t* props = NULL;
   svn_revnum_t fetched_rev = svn_revnum_t(jrevision);
   svn_stream_t* contents = (!jcontents ? NULL
                             : contents_proxy.getStream(subPool));
 
-  SVN_JNI_ERR(svn_ra_get_file(m_session, path, fetched_rev,
+  SVN_JNI_ERR(svn_ra_get_file(m_session, path.c_str(), fetched_rev,
                               contents, &fetched_rev,
                               (jproperties ? &props : NULL),
                               subPool.getPool()),
@@ -578,18 +586,20 @@ RemoteSession::getDirectory(jlong jrevis
                             jint jdirent_fields, jobject jdirents,
                             jobject jproperties)
 {
-  JNIStringHolder path(jpath);
+  SVN::Pool subPool(pool);
+  Relpath path(jpath, subPool);
   if (JNIUtil::isExceptionThrown())
     return SVN_INVALID_REVNUM;
+  SVN_JNI_ERR(path.error_occurred(), SVN_INVALID_REVNUM);
 
-  SVN::Pool subPool(pool);
   apr_hash_t* props = NULL;
   apr_hash_t* dirents = NULL;
   svn_revnum_t fetched_rev = svn_revnum_t(jrevision);
 
   SVN_JNI_ERR(svn_ra_get_dir2(m_session, (jdirents ? &dirents : NULL),
                               &fetched_rev, (jproperties ? &props : NULL),
-                              path, fetched_rev, apr_uint32_t(jdirent_fields),
+                              path.c_str(), fetched_rev,
+                              apr_uint32_t(jdirent_fields),
                               subPool.getPool()),
               SVN_INVALID_REVNUM);
 
@@ -601,7 +611,8 @@ RemoteSession::getDirectory(jlong jrevis
       SVN_JNI_ERR(svn_ra_get_session_url(m_session, &base_url,
                                          subPool.getPool()),
                   SVN_INVALID_REVNUM);
-      fill_dirents(base_url, path, jdirents, dirents, subPool.getPool());
+      fill_dirents(base_url, path.c_str(), jdirents, dirents,
+                   subPool.getPool());
       if (JNIUtil::isExceptionThrown())
         return SVN_INVALID_REVNUM;
     }
@@ -634,13 +645,14 @@ RemoteSession::status(jstring jstatus_ta
 jobject
 RemoteSession::checkPath(jstring jpath, jlong jrevision)
 {
-  JNIStringHolder path(jpath);
+  SVN::Pool subPool(pool);
+  Relpath path(jpath, subPool);
   if (JNIUtil::isExceptionThrown())
     return NULL;
+  SVN_JNI_ERR(path.error_occurred(), NULL);
 
-  SVN::Pool subPool(pool);
   svn_node_kind_t kind;
-  SVN_JNI_ERR(svn_ra_check_path(m_session, path,
+  SVN_JNI_ERR(svn_ra_check_path(m_session, path.c_str(),
                                 svn_revnum_t(jrevision),
                                 &kind, subPool.getPool()),
               NULL);
@@ -659,17 +671,18 @@ RemoteSession::checkPath(jstring jpath, 
 jobject
 RemoteSession::getLocks(jstring jpath, jobject jdepth)
 {
-  JNIStringHolder path(jpath);
+  svn_depth_t depth = EnumMapper::toDepth(jdepth);
   if (JNIUtil::isExceptionThrown())
     return NULL;
 
-  svn_depth_t depth = EnumMapper::toDepth(jdepth);
+  SVN::Pool subPool(pool);
+  Relpath path(jpath, subPool);
   if (JNIUtil::isExceptionThrown())
     return NULL;
+  SVN_JNI_ERR(path.error_occurred(), NULL);
 
-  SVN::Pool subPool(pool);
   apr_hash_t *locks;
-  SVN_JNI_ERR(svn_ra_get_locks2(m_session, &locks, path, depth,
+  SVN_JNI_ERR(svn_ra_get_locks2(m_session, &locks, path.c_str(), depth,
                                 subPool.getPool()),
               NULL);