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/12 11:48:50 UTC
svn commit: r1540997 - in
/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl: ./
native/ native/jniwrapper/ src/org/apache/subversion/javahl/
src/org/apache/subversion/javahl/remote/
src/org/apache/subversion/javahl/util/ tests/org/a...
Author: brane
Date: Tue Nov 12 10:48:49 2013
New Revision: 1540997
URL: http://svn.apache.org/r1540997
Log:
On the javahl-1.8-extensions branch: Sync JavaHL with trunk up to 1540991.
Added:
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_channel.cpp
- copied unchanged from r1540991, subversion/trunk/subversion/bindings/javahl/native/jniwrapper/jni_channel.cpp
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_channel.hpp
- copied unchanged from r1540991, subversion/trunk/subversion/bindings/javahl/native/jniwrapper/jni_channel.hpp
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_string.hpp
- copied unchanged from r1540991, subversion/trunk/subversion/bindings/javahl/native/jniwrapper/jni_string.hpp
Modified:
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/ (props changed)
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CreateJ.cpp
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/ExternalItem.cpp
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/ExternalItem.hpp
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/GlobalConfig.h
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/OperationContext.cpp
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/OperationContext.h
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSession.cpp
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSession.h
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSessionContext.cpp
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSessionContext.h
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/SVNClient.cpp
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_array.hpp
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_base.cpp
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_class_cache.cpp
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_env.hpp
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_exception.hpp
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_list.cpp
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_list.hpp
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_object.hpp
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteFactory.cpp
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigLib.cpp
subversion/branches/javahl-1.8-extensions/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/ClientNotifyInformation.java
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
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/remote/RemoteFactory.java
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/ConfigLib.java
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/PropLib.java
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/UtilTests.java
Propchange: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/
------------------------------------------------------------------------------
Merged /subversion/trunk/subversion/bindings/javahl:r1539408-1540991
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CreateJ.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CreateJ.cpp?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CreateJ.cpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CreateJ.cpp Tue Nov 12 10:48:49 2013
@@ -784,6 +784,7 @@ CreateJ::ClientNotifyInformation(const s
"L"JAVA_PACKAGE"/ClientNotifyInformation$LockStatus;"
"JLjava/lang/String;"
"L"JAVA_PACKAGE"/types/RevisionRange;"
+ "Ljava/lang/String;"
"Ljava/lang/String;Ljava/lang/String;"
"Ljava/util/Map;JJJJJJI)V");
if (JNIUtil::isJavaExceptionThrown() || midCT == 0)
@@ -841,6 +842,10 @@ CreateJ::ClientNotifyInformation(const s
POP_AND_RETURN_NULL;
}
+ jstring jUrl = JNIUtil::makeJString(wcNotify->url);
+ if (JNIUtil::isJavaExceptionThrown())
+ POP_AND_RETURN_NULL;
+
jstring jpathPrefix = JNIUtil::makeJString(wcNotify->path_prefix);
if (JNIUtil::isJavaExceptionThrown())
POP_AND_RETURN_NULL;
@@ -872,7 +877,7 @@ CreateJ::ClientNotifyInformation(const s
jKind, jMimeType, jLock, jErr, jErrStack,
jContentState, jPropState, jLockState,
(jlong) wcNotify->revision, jChangelistName,
- jMergeRange, jpathPrefix, jpropName,
+ jMergeRange, jUrl, jpathPrefix, jpropName,
jrevProps, joldRevision,
jhunkOriginalStart, jhunkOriginalLength,
jhunkModifiedStart, jhunkModifiedLength,
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/ExternalItem.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/ExternalItem.cpp?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/ExternalItem.cpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/ExternalItem.cpp Tue Nov 12 10:48:49 2013
@@ -21,8 +21,9 @@
* @endcopyright
*/
+#include "jniwrapper/jni_stack.hpp"
+
#include "ExternalItem.hpp"
-#include "JNIUtil.h"
#include "Revision.h"
namespace JavaHL {
@@ -92,6 +93,22 @@ ExternalItem::ExternalItem(::Java::Env e
m_peg_revision(*peg_revision)
{}
+svn_wc_external_item2_t*
+ExternalItem::get_external_item(SVN::Pool& svnpool) const
+{
+ svn_wc_external_item2_t* item;
+ apr_pool_t* const pool = svnpool.getPool();
+ SVN_JAVAHL_CHECK(svn_wc_external_item2_create(&item, pool));
+
+ item->target_dir = apr_pstrdup(
+ pool, Java::String::Contents(m_target_dir).c_str());
+ item->url = apr_pstrdup(
+ pool, Java::String::Contents(m_url).c_str());
+ item->revision = m_revision;
+ item->peg_revision = m_peg_revision;
+ return item;
+}
+
} // namespace JavaHL
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/ExternalItem.hpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/ExternalItem.hpp?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/ExternalItem.hpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/ExternalItem.hpp Tue Nov 12 10:48:49 2013
@@ -27,8 +27,12 @@
#include <string>
#include "svn_opt.h"
+#include "svn_wc.h"
+
+#include "Pool.h"
#include "jniwrapper/jni_object.hpp"
+#include "jniwrapper/jni_string.hpp"
namespace JavaHL {
@@ -89,6 +93,12 @@ public:
return &m_peg_revision;
}
+ /**
+ * Returns an @c svn_wc_external_item2_t allocated from @a pool and
+ * filled in with this object's values.
+ */
+ svn_wc_external_item2_t* get_external_item(SVN::Pool& pool) const;
+
private:
static const char* const m_class_name;
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/GlobalConfig.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/GlobalConfig.h?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/GlobalConfig.h (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/GlobalConfig.h Tue Nov 12 10:48:49 2013
@@ -33,7 +33,6 @@ class GlobalConfig
{
public:
static bool useNativeCredentialsStore();
- static jobject getConfigCallback();
};
#endif // JAVAHL_GLOBAL_CONFIG_H
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/OperationContext.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/OperationContext.cpp?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/OperationContext.cpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/OperationContext.cpp Tue Nov 12 10:48:49 2013
@@ -78,10 +78,6 @@ OperationContext::attachJavaObject(
return;
env->DeleteLocalRef(jctx);
-
- m_jcfgcb = env->NewGlobalRef(GlobalConfig::getConfigCallback());
- if (JNIUtil::isJavaExceptionThrown())
- return;
}
OperationContext::~OperationContext()
@@ -285,6 +281,26 @@ OperationContext::getConfigDirectory() c
return (m_configDir.empty() ? NULL : m_configDir.c_str());
}
+void OperationContext::setConfigEventHandler(jobject jcfgcb)
+{
+ JNIEnv *env = JNIUtil::getEnv();
+ if (jcfgcb)
+ {
+ jcfgcb = env->NewGlobalRef(jcfgcb);
+ if (JNIUtil::isJavaExceptionThrown())
+ return;
+ }
+
+ if (m_jcfgcb)
+ env->DeleteGlobalRef(m_jcfgcb);
+ m_jcfgcb = jcfgcb;
+}
+
+jobject OperationContext::getConfigEventHandler() const
+{
+ return m_jcfgcb;
+}
+
const char *
OperationContext::getUsername() const
{
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/OperationContext.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/OperationContext.h?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/OperationContext.h (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/OperationContext.h Tue Nov 12 10:48:49 2013
@@ -96,6 +96,9 @@ class OperationContext
*/
apr_hash_t *getConfigData();
+ void setConfigEventHandler(jobject jcfgcb);
+ jobject getConfigEventHandler() const;
+
static svn_error_t * clientName(void *baton, const char **name, apr_pool_t *pool);
virtual const char * getClientName() const;
};
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSession.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSession.cpp?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSession.cpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSession.cpp Tue Nov 12 10:48:49 2013
@@ -68,7 +68,8 @@ RemoteSession::open(jint jretryAttempts,
jstring jurl, jstring juuid,
jstring jconfigDirectory,
jstring jusername, jstring jpassword,
- jobject jprompter, jobject jprogress)
+ jobject jprompter, jobject jprogress,
+ jobject jcfgcb)
{
JNIEnv *env = JNIUtil::getEnv();
@@ -111,7 +112,7 @@ RemoteSession::open(jint jretryAttempts,
jobject jremoteSession = open(
jretryAttempts, url.c_str(), uuid,
(jconfigDirectory ? configDirectory.c_str() : NULL),
- usernameStr, passwordStr, prompter, jprogress);
+ usernameStr, passwordStr, prompter, jprogress, jcfgcb);
if (JNIUtil::isExceptionThrown() || !jremoteSession)
{
delete prompter;
@@ -125,7 +126,7 @@ RemoteSession::open(jint jretryAttempts,
const char* url, const char* uuid,
const char* configDirectory,
const char* usernameStr, const char* passwordStr,
- Prompter*& prompter, jobject jprogress)
+ Prompter*& prompter, jobject jprogress, jobject jcfgcb)
{
/*
* Initialize ra layer if we have not done so yet
@@ -139,7 +140,7 @@ RemoteSession::open(jint jretryAttempts,
RemoteSession* session = new RemoteSession(
jretryAttempts, url, uuid, configDirectory,
- usernameStr, passwordStr, prompter);
+ usernameStr, passwordStr, prompter, jcfgcb);
if (JNIUtil::isJavaExceptionThrown() || !session)
{
delete session;
@@ -201,11 +202,11 @@ RemoteSession::RemoteSession(int retryAt
const char* url, const char* uuid,
const char* configDirectory,
const char* username, const char* password,
- Prompter*& prompter)
+ Prompter*& prompter, jobject jcfgcb)
: m_session(NULL), m_context(NULL)
{
m_context = new RemoteSessionContext(
- pool, configDirectory, username, password, prompter);
+ pool, configDirectory, username, password, prompter, jcfgcb);
if (JNIUtil::isJavaExceptionThrown())
return;
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSession.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSession.h?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSession.h (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSession.h Tue Nov 12 10:48:49 2013
@@ -48,12 +48,14 @@ class RemoteSession : public SVNBase
jstring jurl, jstring juuid,
jstring jconfigDirectory,
jstring jusername, jstring jpassword,
- jobject jprompter, jobject jprogress);
+ jobject jprompter, jobject jprogress,
+ jobject jcfgcb);
static jobject open(jint jretryAttempts,
const char* url, const char* uuid,
const char* configDirectory,
const char* username, const char* password,
- Prompter*& prompter, jobject jprogress);
+ Prompter*& prompter, jobject jprogress,
+ jobject jcfgcb);
~RemoteSession();
void cancelOperation() const { m_context->cancelOperation(); }
@@ -117,7 +119,7 @@ class RemoteSession : public SVNBase
const char* url, const char* uuid,
const char* configDirectory,
const char* username, const char* password,
- Prompter*& prompter);
+ Prompter*& prompter, jobject jcfgcb);
svn_ra_session_t* m_session;
RemoteSessionContext* m_context;
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSessionContext.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSessionContext.cpp?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSessionContext.cpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSessionContext.cpp Tue Nov 12 10:48:49 2013
@@ -33,7 +33,7 @@
RemoteSessionContext::RemoteSessionContext(
SVN::Pool &pool, const char* configDirectory,
const char* usernameStr, const char* passwordStr,
- Prompter* prompter)
+ Prompter* prompter, jobject jcfgcb)
: OperationContext(pool), m_raCallbacks(NULL)
{
setConfigDirectory(configDirectory);
@@ -44,6 +44,7 @@ RemoteSessionContext::RemoteSessionConte
password(passwordStr);
setPrompt(prompter);
+ setConfigEventHandler(jcfgcb);
/*
* Setup callbacks
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSessionContext.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSessionContext.h?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSessionContext.h (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSessionContext.h Tue Nov 12 10:48:49 2013
@@ -37,7 +37,7 @@ class RemoteSessionContext : public Oper
RemoteSessionContext(SVN::Pool &pool,
const char* jconfigDirectory,
const char* jusername, const char* jpassword,
- Prompter* prompter);
+ Prompter* prompter, jobject jcfgcb);
virtual ~RemoteSessionContext();
void activate(jobject jremoteSession, jobject jprogress);
void * getCallbackBaton();
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/SVNClient.cpp?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/SVNClient.cpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/SVNClient.cpp Tue Nov 12 10:48:49 2013
@@ -1511,7 +1511,6 @@ SVNClient::openRemoteSession(const char*
ctx, subPool.getPool()),
NULL);
- jobject jctx = context.getSelf();
if (JNIUtil::isJavaExceptionThrown())
return NULL;
@@ -1525,7 +1524,7 @@ SVNClient::openRemoteSession(const char*
retryAttempts, path_info.url.c_str(), path_info.uuid.c_str(),
context.getConfigDirectory(),
context.getUsername(), context.getPassword(),
- prompter, jctx);
+ prompter, context.getSelf(), context.getConfigEventHandler());
if (JNIUtil::isJavaExceptionThrown())
delete prompter;
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_array.hpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_array.hpp?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_array.hpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_array.hpp Tue Nov 12 10:48:49 2013
@@ -47,11 +47,20 @@ public:
*/
explicit ByteArray(Env env, jbyteArray array)
: m_env(env),
- m_length(array ? m_env.GetArrayLength(array) : -1),
+ m_length(array ? m_env.GetArrayLength(array) : 0),
m_array(array)
{}
/**
+ * Constructs a new, uninitialized array of size @a length.
+ */
+ explicit ByteArray(Env env, jsize length)
+ : m_env(env),
+ m_length(length),
+ m_array(m_env.NewByteArray(m_length))
+ {}
+
+ /**
* Constructs a new array and wrapper from @a text.
*/
explicit ByteArray(Env env, const char* text)
@@ -59,7 +68,7 @@ public:
m_length(jsize(::std::strlen(text))),
m_array(m_env.NewByteArray(m_length))
{
- ByteArray::Contents contents(*this);
+ ByteArray::MutableContents contents(*this);
::memcpy(contents.data(), text, m_length);
}
@@ -72,7 +81,7 @@ public:
m_length(length),
m_array(m_env.NewByteArray(m_length))
{
- ByteArray::Contents contents(*this);
+ ByteArray::MutableContents contents(*this);
::memcpy(contents.data(), data, m_length);
}
@@ -84,7 +93,7 @@ public:
m_length(jsize(text.size())),
m_array(m_env.NewByteArray(m_length))
{
- ByteArray::Contents contents(*this);
+ ByteArray::MutableContents contents(*this);
::memcpy(contents.data(), text.c_str(), m_length);
}
@@ -109,28 +118,12 @@ public:
*
* Objects of this class should be created within the scope where
* the raw data stored in the array must be manipulated. They will
- * create either a mutable or an immutable mirror of the array
- * contents, depending on the constantness of the array wrapper. The
- * data will be released (and changes copied into the JVM, depending
- * on access mode) by the destructor.
+ * create an immutable mirror of the array contents.
*/
class Contents
{
public:
/**
- * Constructs a mutable array contents accessor.
- */
- explicit Contents(ByteArray& array)
- : m_array(array),
- m_data(array.m_env.GetByteArrayElements(array.m_array, NULL)),
- m_mode(0)
- {
- //fprintf(stderr,
- // "%s:%d: non-const byte array data, size=%d\n",
- // __FILE__, __LINE__, int(m_array.m_length));
- }
-
- /**
* Constructs an immutable array contents accessor.
*
* Whilst the returned contents are themselves mutable, the
@@ -138,25 +131,25 @@ public:
*/
explicit Contents(const ByteArray& array)
: m_array(array),
- m_data(array.m_env.GetByteArrayElements(array.m_array, NULL)),
- m_mode(JNI_ABORT)
- {
- //fprintf(stderr,
- // "%s:%d: const byte array data, size=%d\n",
- // __FILE__, __LINE__, int(m_array.m_length));
- }
+ m_data(!array.m_array ? NULL
+ : array.m_env.GetByteArrayElements(array.m_array, NULL))
+ {}
/**
- * Releases the array contents, possibly committing changes to the JVM.
+ * Releases the array contents.
*/
~Contents()
{
- const Env& env = m_array.m_env;
- env.ReleaseByteArrayElements(m_array.m_array, m_data, m_mode);
+ if (m_data)
+ {
+ const Env& env = m_array.m_env;
+ env.ReleaseByteArrayElements(m_array.m_array, m_data, JNI_ABORT);
+ }
}
/**
- * Returns the address of the array contents.
+ * Returns the address of the immutable array contents.
+ * @note The data will @b not be NUL-terminated!
*/
const char* data() const
{
@@ -164,16 +157,67 @@ public:
}
/**
- * Returns the address of the array contents.
+ * Returns the size of the array contents.
+ */
+ jsize length() const
+ {
+ return m_array.m_length;
+ }
+
+ /**
+ * Copies the array contents to a NUL-terminated string allocated
+ * from @a result_pool.
+ */
+ svn_string_t* get_string(const ::SVN::Pool& result_pool) const
+ {
+ if (m_data)
+ return svn_string_ncreate(data(), m_array.m_length,
+ result_pool.getPool());
+ return NULL;
+ }
+
+ protected:
+ const ByteArray& m_array;
+ jbyte* m_data;
+ };
+
+ /**
+ * Accessor class for the contents of the byte array.
+ *
+ * Behaves like the #Contents class, but the mirrored contents are
+ * considered mutable and any changes made to them will be committed
+ * to the JVM.
+ */
+ class MutableContents : protected Contents
+ {
+ public:
+ /**
+ * Constructs a mutable array contents accessor.
+ */
+ explicit MutableContents(ByteArray& array)
+ : Contents(array)
+ {}
+
+ /**
+ * Releases the array contents, committing changes to the JVM.
+ */
+ ~MutableContents()
+ {
+ if (m_data)
+ {
+ // Prevent double-release by the Contents desctuctor
+ jbyte* const data = m_data;
+ m_data = NULL;
+ m_array.m_env.ReleaseByteArrayElements(m_array.m_array, data, 0);
+ }
+ }
+ /**
+ * Returns the mutable address of the array contents.
* @note The data will @b not be NUL-terminated!
- * @throw std::logic_error if the data reference is immutable.
*/
char* data()
{
- if (!m_mode)
- return reinterpret_cast<char*>(const_cast<jbyte*>(m_data));
- throw std::logic_error(
- _("Can't make a writable pointer to immutable array contents."));
+ return const_cast<char*>(Contents::data());
}
/**
@@ -181,7 +225,7 @@ public:
*/
jsize length() const
{
- return m_array.m_length;
+ return Contents::length();
}
/**
@@ -190,14 +234,8 @@ public:
*/
svn_string_t* get_string(const ::SVN::Pool& result_pool) const
{
- return svn_string_ncreate(data(), m_array.m_length,
- result_pool.getPool());
+ return Contents::get_string(result_pool);
}
-
- private:
- const ByteArray& m_array;
- jbyte* const m_data;
- const jint m_mode;
};
private:
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_base.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_base.cpp?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_base.cpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_base.cpp Tue Nov 12 10:48:49 2013
@@ -25,6 +25,7 @@
#include "jni_globalref.hpp"
#include "jni_exception.hpp"
#include "jni_object.hpp"
+#include "jni_string.hpp"
#include "jni_array.hpp"
@@ -129,8 +130,8 @@ const char* const Object::m_class_name =
// Class Java::Class
const char* const Class::m_class_name = "java/lang/Class";
-jmethodID Class::m_mid_get_class = NULL;
-jmethodID Class::m_mid_get_name = NULL;
+MethodID Class::m_mid_get_class;
+MethodID Class::m_mid_get_name;
void Class::static_init(Env env)
{
m_mid_get_class = env.GetMethodID(
@@ -171,10 +172,6 @@ jstring Class::get_name() const
// Class Java::String
const char* const String::m_class_name = "java/lang/String";
-void String::static_init(Env env)
-{
- // TODO: Init various string methods
-}
// class Java::Exception
@@ -188,7 +185,7 @@ jstring Exception::get_message() const
}
const char* const Exception::m_class_name = "java/lang/Throwable";
-jmethodID Exception::m_mid_get_message = NULL;
+MethodID Exception::m_mid_get_message;
void Exception::static_init(Env env)
{
m_mid_get_message = env.GetMethodID(
@@ -208,6 +205,9 @@ const char* const NullPointerException::
const char* const OutOfMemoryError::m_class_name =
"java/lang/OutOfMemoryError";
+const char* const IOException::m_class_name =
+ "java/io/IOException";
+
} // namespace Java
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_class_cache.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_class_cache.cpp?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_class_cache.cpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_class_cache.cpp Tue Nov 12 10:48:49 2013
@@ -25,6 +25,7 @@
#include "jni_globalref.hpp"
#include "jni_exception.hpp"
#include "jni_object.hpp"
+#include "jni_string.hpp"
#include "../SubversionException.hpp"
@@ -61,7 +62,7 @@ ClassCache::ClassCache(Env env)
// no-op: Object::static_init(env);
Class::static_init(env);
Exception::static_init(env);
- String::static_init(env);
+ // no-op: String::static_init(env);
// no-op: ::JavaHL::SubversionException::static_init(env);
}
#undef SVN_JAVAHL_JNIWRAPPER_CLASS_CACHE_INIT
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_env.hpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_env.hpp?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_env.hpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_env.hpp Tue Nov 12 10:48:49 2013
@@ -45,6 +45,105 @@
namespace Java {
/**
+ * Auto-initializing proxy for the JNI method ID.
+ *
+ * Behaves like a @c jmethodID but automatically initializes to @c NULL.
+ *
+ * @since New in 1.9.
+ */
+class MethodID
+{
+public:
+ MethodID()
+ : m_mid(NULL)
+ {}
+
+ MethodID(jmethodID mid)
+ : m_mid(mid)
+ {}
+
+ MethodID(const MethodID& that)
+ : m_mid(that.m_mid)
+ {}
+
+ MethodID& operator=(jmethodID mid)
+ {
+ m_mid = mid;
+ return *this;
+ }
+
+ MethodID& operator=(const MethodID& that)
+ {
+ m_mid = that.m_mid;
+ return *this;
+ }
+
+ operator jmethodID() const
+ {
+ return m_mid;
+ }
+
+ operator bool() const
+ {
+ return (NULL != m_mid);
+ }
+
+private:
+ jmethodID m_mid;
+};
+
+
+/**
+ * Auto-initializing proxy for the JNI field ID.
+ *
+ * Behaves like a @c jfieldID but automatically initializes to @c NULL.
+ *
+ * @since New in 1.9.
+ */
+class FieldID
+{
+public:
+ FieldID()
+ : m_fid(NULL)
+ {}
+
+ FieldID(jfieldID mid)
+ : m_fid(mid)
+ {}
+
+ FieldID(const FieldID& that)
+ : m_fid(that.m_fid)
+ {}
+
+ FieldID& operator=(jfieldID fid)
+ {
+ m_fid = fid;
+ return *this;
+ }
+
+ FieldID& operator=(const FieldID& that)
+ {
+ m_fid = that.m_fid;
+ return *this;
+ }
+
+ operator jfieldID() const
+ {
+ return m_fid;
+ }
+
+ operator bool() const
+ {
+ return (NULL != m_fid);
+ }
+
+private:
+ jfieldID m_fid;
+};
+
+
+
+/**
* Encapsulation of a JNI environment reference.
*
* This class wraps all (relevant) JNI functions and checks for thrown
@@ -410,6 +509,14 @@ public:
SVN_JAVAHL_JNIWRAPPER_PRIMITIVE_TYPE_ARRAY(jdouble, Double)
#undef SVN_JAVAHL_JNIWRAPPER_PRIMITIVE_TYPE_ARRAY
+ /** Wrapped JNI function. */
+ void* GetDirectBufferAddress(jobject buffer) const
+ {
+ void* const addr = m_env->GetDirectBufferAddress(buffer);
+ check_java_exception();
+ return addr;
+ }
+
private:
::JNIEnv* m_env;
static ::JavaVM* m_jvm;
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_exception.hpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_exception.hpp?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_exception.hpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_exception.hpp Tue Nov 12 10:48:49 2013
@@ -146,7 +146,7 @@ private:
friend class ClassCache;
static void static_init(Env env);
static const char* const m_class_name;
- static jmethodID m_mid_get_message;
+ static MethodID m_mid_get_message;
};
/**
@@ -206,6 +206,25 @@ private:
static const char* const m_class_name;
};
+/**
+ * Generator class for exceptions of type @c java.io.IOException.
+ *
+ * @since New in 1.9.
+ */
+class IOException : public Exception
+{
+public:
+ /**
+ * Constructs an exception generator object.
+ */
+ explicit IOException(Env env)
+ : Exception(env, m_class_name)
+ {}
+
+private:
+ static const char* const m_class_name;
+};
+
} // namespace Java
#endif // SVN_JAVAHL_JNIWRAPPER_ENV_HPP
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_list.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_list.cpp?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_list.cpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_list.cpp Tue Nov 12 10:48:49 2013
@@ -64,11 +64,7 @@ jobject make_array_list(Env env, const c
BaseMutableList::BaseMutableList(Env env, jint length)
: Object(env, m_class_name,
- make_array_list(env, m_class_name, length)),
- m_mid_add(NULL),
- m_mid_clear(NULL),
- m_mid_get(NULL),
- m_mid_size(NULL)
+ make_array_list(env, m_class_name, length))
{}
void BaseMutableList::add(jobject obj)
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_list.hpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_list.hpp?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_list.hpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_list.hpp Tue Nov 12 10:48:49 2013
@@ -132,11 +132,7 @@ protected:
* Constructs the list wrapper, deriving the class from @a jlist.
*/
explicit BaseMutableList(Env env, jobject jlist)
- : Object(env, jlist),
- m_mid_add(NULL),
- m_mid_clear(NULL),
- m_mid_get(NULL),
- m_mid_size(NULL)
+ : Object(env, jlist)
{}
/**
@@ -157,10 +153,10 @@ protected:
private:
static const char* const m_class_name;
- jmethodID m_mid_add;
- jmethodID m_mid_clear;
- mutable jmethodID m_mid_get;
- mutable jmethodID m_mid_size;
+ MethodID m_mid_add;
+ MethodID m_mid_clear;
+ mutable MethodID m_mid_get;
+ mutable MethodID m_mid_size;
};
/**
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_object.hpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_object.hpp?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_object.hpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/jniwrapper/jni_object.hpp Tue Nov 12 10:48:49 2013
@@ -24,9 +24,6 @@
#ifndef SVN_JAVAHL_JNIWRAPPER_OBJECT_HPP
#define SVN_JAVAHL_JNIWRAPPER_OBJECT_HPP
-#include <cstring>
-#include <string>
-
#include "jni_env.hpp"
#include "jni_globalref.hpp"
@@ -190,159 +187,8 @@ private:
friend class ClassCache;
static void static_init(Env env);
static const char* const m_class_name;
- static jmethodID m_mid_get_class;
- static jmethodID m_mid_get_name;
-};
-
-
-/**
- * Object wrapper for @c java.lang.String.
- *
- * The associated JNI class reference is stored for the lifetime of
- * the JVM in the global class cache.
- *
- * @since New in 1.9.
- */
-class String : public Object
-{
-public:
- /**
- * Constructs a wrapper around an existing string @a str.
- */
- explicit String(Env env, jstring str)
- : Object(env, ClassCache::get_string(), str)
- {}
-
- /**
- * Constructs a new string and wrapper from @a text.
- */
- explicit String(Env env, const char* text)
- : Object(env, ClassCache::get_string(), env.NewStringUTF(text))
- {}
-
- /**
- * Returns the wrapped JNI object reference. Overridden from the
- * base class in order to return the correct JNI reference type.
- */
- jstring get() const
- {
- return jstring(Object::get());
- }
-
- /**
- * Returns the number of Unicode characters in the string.
- */
- jsize length() const
- {
- return m_env.GetStringLength(get());
- }
-
- /**
- * Returns the length of the modified UTF-8 representation of the
- * string.
- */
- jsize utf8_length() const
- {
- return m_env.GetStringUTFLength(get());
- }
-
- /**
- * Accessor class for the contents of the string.
- *
- * Objects of this class should be created within the scope where
- * the raw C string is required. They will create either a mutable
- * or an immutable modified UTF-8 representation of the string
- * contents, depending on the constantness of the string
- * wrapper. The data will be released (and changes copied into the
- * JVM, depending on access mode) by the destructor.
- */
- class Contents
- {
- public:
- /**
- * Constructs a mutable string contents accessor.
- */
- explicit Contents(String& str)
- : m_str(str),
- m_text(!str.get() ? NULL
- : str.m_env.GetStringUTFChars(str.get(), NULL)),
- m_new_text(NULL),
- m_mutable(true),
- m_length(m_text ? jsize(::std::strlen(m_text)) : 0)
- {}
-
- /**
- * Constructs an immutable string contents accessor.
- */
- explicit Contents(const String& str)
- : m_str(str),
- m_text(!str.get() ? NULL
- : str.m_env.GetStringUTFChars(str.get(), NULL)),
- m_new_text(NULL),
- m_mutable(false),
- m_length(m_text ? jsize(::std::strlen(m_text)) : 0)
- {}
-
- /**
- * Releases the string contents, possibly committing changes to the JVM.
- */
- ~Contents()
- {
- if (m_text)
- m_str.m_env.ReleaseStringUTFChars(m_str.get(), m_new_text);
- }
-
- /**
- * Returns the C representation of the string contents.
- */
- const char* c_str() const
- {
- if (m_new_text)
- return m_new_text;
- return m_text;
- }
-
- /**
- * Returns the length of the C representation of the string.
- */
- jsize utf8_length() const
- {
- return m_length;
- }
-
- /**
- * Sets a new value for the string, to be committed to the JVM
- * when the accessor object is destroyed.
- * @throw std::logic_error if this is a @c null or immutable string.
- */
- void set_value(const char* new_text)
- {
- if (m_text && m_mutable)
- {
- m_new_text = new_text;
- m_length = jsize(::std::strlen(new_text));
- }
- else if (!m_mutable)
- throw std::logic_error(
- _("Cannot change the contents of an immutable String"));
- else
- throw std::logic_error(
- _("Cannot change the contents of a null String"));
- }
-
- private:
- const String& m_str;
- const char* m_text;
- const char* m_new_text;
- const bool m_mutable;
- jsize m_length;
- };
-
-private:
- friend class Contents;
- friend class ClassCache;
- static void static_init(Env env);
- static const char* const m_class_name;
+ static MethodID m_mid_get_class;
+ static MethodID m_mid_get_name;
};
} // namespace Java
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp Tue Nov 12 10:48:49 2013
@@ -1651,6 +1651,36 @@ Java_org_apache_subversion_javahl_SVNCli
}
JNIEXPORT void JNICALL
+Java_org_apache_subversion_javahl_SVNClient_setConfigEventHandler(
+ JNIEnv* env, jobject jthis, jobject jcallback)
+{
+ JNIEntry(SVNClient, setConfigEventHandler);
+ SVNClient *cl = SVNClient::getCppObject(jthis);
+ if (cl == NULL)
+ {
+ JNIUtil::throwError(_("bad C++ this"));
+ return;
+ }
+
+ cl->getClientContext().setConfigEventHandler(jcallback);
+}
+
+JNIEXPORT jobject JNICALL
+Java_org_apache_subversion_javahl_SVNClient_getConfigEventHandler(
+ JNIEnv* env, jobject jthis)
+{
+ JNIEntry(SVNClient, getConfigEventHandler);
+ SVNClient *cl = SVNClient::getCppObject(jthis);
+ if (cl == NULL)
+ {
+ JNIUtil::throwError(_("bad C++ this"));
+ return NULL;
+ }
+
+ return cl->getClientContext().getConfigEventHandler();
+}
+
+JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNClient_cancelOperation
(JNIEnv *env, jobject jthis)
{
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteFactory.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteFactory.cpp?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteFactory.cpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteFactory.cpp Tue Nov 12 10:48:49 2013
@@ -40,7 +40,8 @@ Java_org_apache_subversion_javahl_remote
jstring jurl, jstring juuid,
jstring jconfigDirectory,
jstring jusername, jstring jpassword,
- jobject jprompter, jobject jprogress)
+ jobject jprompter, jobject jprogress,
+ jobject jcfgcb)
{
//JNI macros need jthis but this is a static call
JNIEntryStatic(RemoteFactory, open);
@@ -50,7 +51,7 @@ Java_org_apache_subversion_javahl_remote
*/
jobject jremoteSession = RemoteSession::open(
jretryAttempts, jurl, juuid,
- jconfigDirectory, jusername, jpassword, jprompter, jprogress);
+ jconfigDirectory, jusername, jpassword, jprompter, jprogress, jcfgcb);
if (JNIUtil::isJavaExceptionThrown())
return NULL;
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigLib.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigLib.cpp?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigLib.cpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigLib.cpp Tue Nov 12 10:48:49 2013
@@ -34,7 +34,6 @@
namespace {
bool g_ignore_native_credentials = false;
-jobject g_config_callback = NULL;
} // anonymous callback
bool GlobalConfig::useNativeCredentialsStore()
@@ -43,13 +42,6 @@ bool GlobalConfig::useNativeCredentialsS
return !g_ignore_native_credentials;
}
-jobject GlobalConfig::getConfigCallback()
-{
- JNICriticalSection lock(*JNIUtil::g_configMutex);
- return g_config_callback;
-}
-
-
JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_util_ConfigLib_enableNativeCredentialsStore(
JNIEnv* env, jobject jthis)
@@ -70,11 +62,6 @@ Java_org_apache_subversion_javahl_util_C
g_ignore_native_credentials = true;
}
-/*
- * Class: org_apache_subversion_javahl_util_ConfigLib
- * Method: isNativeCredentialsStoreEnabled
- * Signature: ()Z
- */
JNIEXPORT jboolean JNICALL
Java_org_apache_subversion_javahl_util_ConfigLib_isNativeCredentialsStoreEnabled(
JNIEnv* env, jobject jthis)
@@ -83,36 +70,3 @@ Java_org_apache_subversion_javahl_util_C
return jboolean(GlobalConfig::useNativeCredentialsStore());
}
-
-/*
- * Class: org_apache_subversion_javahl_util_ConfigLib
- * Method: setConfigEventHandler
- * Signature: (Lorg/apache/subversion/javahl/callback/ConfigEvent;)V
- */
-JNIEXPORT void JNICALL
-Java_org_apache_subversion_javahl_util_ConfigLib_setConfigEventHandler(
- JNIEnv* env, jobject jthis, jobject jcallback)
-{
- JNIEntry(ConfigLib, setConfigEventHandler);
-
- JNICriticalSection lock(*JNIUtil::g_configMutex);
- if (g_config_callback)
- {
- env->DeleteGlobalRef(g_config_callback);
- g_config_callback = NULL;
- }
- if (jcallback)
- {
- g_config_callback = env->NewGlobalRef(jcallback);
- env->DeleteLocalRef(jcallback);
- }
-}
-
-JNIEXPORT jobject JNICALL
-Java_org_apache_subversion_javahl_util_ConfigLib_getConfigEventHandler(
- JNIEnv* env, jobject jthis)
-{
- JNIEntry(ConfigLib, getConfigEventHandler);
-
- return GlobalConfig::getConfigCallback();
-}
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_PropLib.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_PropLib.cpp?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_PropLib.cpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_PropLib.cpp Tue Nov 12 10:48:49 2013
@@ -42,6 +42,7 @@
#include "svn_time.h"
#include "svn_wc.h"
+#include "private/svn_wc_private.h"
#include "svn_private_config.h"
@@ -143,6 +144,7 @@ Java_org_apache_subversion_javahl_util_P
#include "jniwrapper/jni_stack.hpp"
#include "jniwrapper/jni_array.hpp"
#include "jniwrapper/jni_list.hpp"
+#include "jniwrapper/jni_string.hpp"
#include "ExternalItem.hpp"
#include "SubversionException.hpp"
@@ -218,18 +220,16 @@ Java_org_apache_subversion_javahl_util_P
apr_array_header_t* externals;
{
- const Java::String::Contents parent_dir_contents(parent_dir);
- const Java::ByteArray::Contents descr_contents(description);
-
// There is no guarantee that the description contents are
// null-terminated. Copy them to an svn_string_t to make sure
// that they are.
- svn_string_t* const safe_contents = descr_contents.get_string(pool);
+ svn_string_t* const description_contents =
+ Java::ByteArray::Contents(description).get_string(pool);
SVN_JAVAHL_CHECK(svn_wc_parse_externals_description3(
&externals,
- parent_dir_contents.c_str(),
- safe_contents->data,
+ Java::String::Contents(parent_dir).c_str(),
+ description_contents->data,
svn_boolean_t(jcanonicalize_url),
pool.getPool()));
}
@@ -256,6 +256,7 @@ Java_org_apache_subversion_javahl_util_P
return NULL;
}
+
JNIEXPORT jbyteArray JNICALL
Java_org_apache_subversion_javahl_util_PropLib_unparseExternals(
JNIEnv* jenv, jobject jthis,
@@ -337,16 +338,44 @@ Java_org_apache_subversion_javahl_util_P
// Validate the result. Even though we generated the string
// ourselves, we did not validate the input paths and URLs.
const std::string description(buffer.str());
- {
- const Java::String::Contents parent_dir_contents(parent_dir);
- SVN_JAVAHL_CHECK(svn_wc_parse_externals_description3(
- NULL,
- parent_dir_contents.c_str(),
- description.c_str(),
- false, iterpool.getPool()));
- }
+ SVN_JAVAHL_CHECK(svn_wc_parse_externals_description3(
+ NULL,
+ Java::String::Contents(parent_dir).c_str(),
+ description.c_str(),
+ false, iterpool.getPool()));
return Java::ByteArray(env, description).get();
}
SVN_JAVAHL_JNI_CATCH;
return NULL;
}
+
+
+JNIEXPORT jstring JNICALL
+Java_org_apache_subversion_javahl_util_PropLib_resolveExternalsUrl(
+ JNIEnv* jenv, jobject jthis,
+ jobject jitem, jstring jrepos_root_url, jstring jparent_dir_url)
+{
+ SVN_JAVAHL_JNI_TRY(PropLib, unparseExternals)
+ {
+ const Java::Env env(jenv);
+
+ const Java::String repos_root_url(env, jrepos_root_url);
+ const Java::String parent_dir_url(env, jparent_dir_url);
+ const JavaHL::ExternalItem item(env, jitem);
+
+ // Using a "global" request pool since we don't keep a context
+ // with its own pool around for these functions.
+ SVN::Pool pool;
+
+ const char* resolved_url;
+ SVN_JAVAHL_CHECK(svn_wc__resolve_relative_external_url(
+ &resolved_url,
+ item.get_external_item(pool),
+ Java::String::Contents(repos_root_url).c_str(),
+ Java::String::Contents(parent_dir_url).c_str(),
+ pool.getPool(), pool.getPool()));
+ return Java::String(env, resolved_url).get();
+ }
+ SVN_JAVAHL_JNI_CATCH;
+ return NULL;
+}
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ClientNotifyInformation.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ClientNotifyInformation.java?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ClientNotifyInformation.java (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ClientNotifyInformation.java Tue Nov 12 10:48:49 2013
@@ -46,6 +46,14 @@ public class ClientNotifyInformation ext
private static final long serialVersionUID = 2L;
/**
+ * Path, either absolute or relative to the current working
+ * directory (i.e., not relative to an anchor). <code>path</code>
+ * is <code>null</vode> when the real target is an URL that is
+ * available in {@link #url}.
+ */
+ private String path;
+
+ /**
* The {@link Action} which triggered this event.
*/
private Action action;
@@ -107,6 +115,12 @@ public class ClientNotifyInformation ext
private RevisionRange mergeRange;
/**
+ * Similar to {@link #path}, but when not <code>null</code>, the
+ * notification is about a UR>.
+ */
+ private String url;
+
+ /**
* A common absolute path prefix that can be subtracted from .path.
*/
private String pathPrefix;
@@ -147,31 +161,35 @@ public class ClientNotifyInformation ext
* @param changelistName The name of the changelist.
* @param mergeRange The range of the merge just beginning to occur.
* @param pathPrefix A common path prefix.
+ * @since 1.9
*/
public ClientNotifyInformation(String path, Action action, NodeKind kind,
String mimeType, Lock lock, String errMsg,
+ List<ClientException.ErrorMessage> errMsgStack,
Status contentState, Status propState,
LockStatus lockState, long revision,
String changelistName, RevisionRange mergeRange,
- String pathPrefix, String propName,
+ String url, String pathPrefix, String propName,
Map<String, String> revProps, long oldRevision,
long hunkOriginalStart, long hunkOriginalLength,
long hunkModifiedStart, long hunkModifiedLength,
long hunkMatchedLine, int hunkFuzz)
{
- super(path == null ? "" : path);
+ super(path != null ? path : (url != null ? url : ""));
+ this.path = path;
this.action = action;
this.kind = kind;
this.mimeType = mimeType;
this.lock = lock;
this.errMsg = errMsg;
- this.errMsgStack = null;
+ this.errMsgStack = errMsgStack;
this.contentState = contentState;
this.propState = propState;
this.lockState = lockState;
this.revision = revision;
this.changelistName = changelistName;
this.mergeRange = mergeRange;
+ this.url = url;
this.pathPrefix = pathPrefix;
this.propName = propName;
this.revProps = revProps;
@@ -185,14 +203,11 @@ public class ClientNotifyInformation ext
}
/**
- * This constructor will be called only by the native code.
- *
- * In addition to all the other parameters, sets the detailed
- * message stack.
+ * @deprecated Constructor compatible with teh 1.8 API; uses
+ * <code>null</code> URL and errMsgStack values.
*/
- protected ClientNotifyInformation(String path, Action action, NodeKind kind,
+ public ClientNotifyInformation(String path, Action action, NodeKind kind,
String mimeType, Lock lock, String errMsg,
- List<ClientException.ErrorMessage> errMsgStack,
Status contentState, Status propState,
LockStatus lockState, long revision,
String changelistName, RevisionRange mergeRange,
@@ -202,18 +217,18 @@ public class ClientNotifyInformation ext
long hunkModifiedStart, long hunkModifiedLength,
long hunkMatchedLine, int hunkFuzz)
{
- this(path, action, kind, mimeType, lock, errMsg,
+ this(path, action, kind, mimeType, lock, errMsg, null,
contentState, propState, lockState, revision,
- changelistName, mergeRange, pathPrefix, propName,
- revProps, oldRevision,
+ changelistName, mergeRange, null, pathPrefix,
+ propName, revProps, oldRevision,
hunkOriginalStart, hunkOriginalLength,
hunkModifiedStart, hunkModifiedLength,
hunkMatchedLine, hunkFuzz);
- this.errMsgStack = errMsgStack;
}
/**
* @return The path of the item, which is the source of the event.
+ * This may actually be a URL.
*/
public String getPath()
{
@@ -221,6 +236,15 @@ public class ClientNotifyInformation ext
}
/**
+ * @return {@link #path}, which may be <code>null</code>.
+ * @since 1.9
+ */
+ public String getNotifiedPath()
+ {
+ return this.path;
+ }
+
+ /**
* @return The {@link Action} which triggered this event.
*/
public Action getAction()
@@ -317,6 +341,15 @@ public class ClientNotifyInformation ext
}
/**
+ * @return {@link #url}, which may be <code>null</code>
+ * @since 1.9
+ */
+ public String getUrl()
+ {
+ return this.url;
+ }
+
+ /**
* @return The common absolute path prefix.
*/
public String getPathPrefix()
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java Tue Nov 12 10:48:49 2013
@@ -1076,6 +1076,19 @@ public interface ISVNClient
String getConfigDirectory() throws ClientException;
/**
+ * Set an event handler that will be called every time the
+ * configuration is loaded by this client object.
+ */
+ void setConfigEventHandler(ConfigEvent configHandler)
+ throws ClientException;
+
+ /**
+ * Return a reference to the installed configuration event
+ * handler. The returned value may be <code>null</code>.
+ */
+ ConfigEvent getConfigEventHandler() throws ClientException;
+
+ /**
* cancel the active operation
* @throws ClientException
*/
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java Tue Nov 12 10:48:49 2013
@@ -576,6 +576,12 @@ public class SVNClient implements ISVNCl
public native String getConfigDirectory()
throws ClientException;
+ public native void setConfigEventHandler(ConfigEvent configHandler)
+ throws ClientException;
+
+ public native ConfigEvent getConfigEventHandler()
+ throws ClientException;
+
public native void cancelOperation()
throws ClientException;
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=1540997&r1=1540996&r2=1540997&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 Tue Nov 12 10:48:49 2013
@@ -36,6 +36,7 @@ public class SVNUtil
//
// Global configuration
//
+ private static final ConfigLib configLib = new ConfigLib();
/**
* Enable storing authentication credentials in Subversion's
@@ -52,7 +53,7 @@ public class SVNUtil
public static void enableNativeCredentialsStore()
throws ClientException
{
- new ConfigLib().enableNativeCredentialsStore();
+ configLib.enableNativeCredentialsStore();
}
/**
@@ -76,7 +77,7 @@ public class SVNUtil
public static void disableNativeCredentialsStore()
throws ClientException
{
- new ConfigLib().disableNativeCredentialsStore();
+ configLib.disableNativeCredentialsStore();
}
/**
@@ -85,37 +86,13 @@ public class SVNUtil
public static boolean isNativeCredentialsStoreEnabled()
throws ClientException
{
- return new ConfigLib().isNativeCredentialsStoreEnabled();
- }
-
- /**
- * Set an event handler that will be called every time the
- * configuration is loaded.
- * <p>
- * This setting will be inherited by all ISVNClient and ISVNRemote
- * objects. Changing the setting will not affect existing such
- * objects.
- * @throws ClientException
- */
- public static void setConfigEventHandler(ConfigEvent configHandler)
- throws ClientException
- {
- new ConfigLib().setConfigEventHandler(configHandler);
- }
-
- /**
- * Return a reference to the installed configuration event
- * handler. The returned value may be <code>null</code>.
- */
- public static ConfigEvent getConfigEventHandler()
- throws ClientException
- {
- return new ConfigLib().getConfigEventHandler();
+ return configLib.isNativeCredentialsStoreEnabled();
}
//
// Diff and Merge
//
+ private static final DiffLib diffLib = new DiffLib();
/**
* Options to control the behaviour of the file diff routines.
@@ -234,10 +211,10 @@ public class SVNUtil
OutputStream resultStream)
throws ClientException
{
- return new DiffLib().fileDiff(originalFile, modifiedFile, diffOptions,
- originalHeader, modifiedHeader,
- headerEncoding,
- relativeToDir, resultStream);
+ return diffLib.fileDiff(originalFile, modifiedFile, diffOptions,
+ originalHeader, modifiedHeader,
+ headerEncoding,
+ relativeToDir, resultStream);
}
@@ -278,16 +255,17 @@ public class SVNUtil
OutputStream resultStream)
throws ClientException
{
- return new DiffLib().fileMerge(originalFile, modifiedFile, latestFile,
- diffOptions,
- conflictOriginal, conflictModified,
- conflictLatest, conflictSeparator,
- conflictStyle, resultStream);
+ return diffLib.fileMerge(originalFile, modifiedFile, latestFile,
+ diffOptions,
+ conflictOriginal, conflictModified,
+ conflictLatest, conflictSeparator,
+ conflictStyle, resultStream);
}
//
// Property validation and parsing
//
+ private static final PropLib propLib = new PropLib();
/**
* Validate the value of an <code>svn:</code> property on file or
@@ -309,7 +287,7 @@ public class SVNUtil
String mimeType)
throws ClientException
{
- return new PropLib().canonicalizeNodeProperty(
+ return propLib.canonicalizeNodeProperty(
name, value, path, kind, mimeType, null);
}
@@ -338,7 +316,7 @@ public class SVNUtil
String mimeType, InputStream fileContents)
throws ClientException
{
- return new PropLib().canonicalizeNodeProperty(
+ return propLib.canonicalizeNodeProperty(
name, value, path, kind, mimeType, fileContents);
}
@@ -366,8 +344,8 @@ public class SVNUtil
boolean canonicalizeUrl)
throws ClientException
{
- return new PropLib().parseExternals(description, parentDirectory,
- canonicalizeUrl);
+ return propLib.parseExternals(description, parentDirectory,
+ canonicalizeUrl);
}
/**
@@ -384,7 +362,7 @@ public class SVNUtil
String parentDirectory)
throws SubversionException
{
- return new PropLib().unparseExternals(items, parentDirectory, false);
+ return propLib.unparseExternals(items, parentDirectory, false);
}
/**
@@ -399,6 +377,43 @@ public class SVNUtil
List<ExternalItem> items, String parentDirectory)
throws SubversionException
{
- return new PropLib().unparseExternals(items, parentDirectory, true);
+ return propLib.unparseExternals(items, parentDirectory, true);
+ }
+
+ /**
+ * If the URL in <code>external</code> is relative, resolve it to
+ * an absolute URL, using <code>reposRootUrl</code> and
+ * <code>parentDirUrl</code> to provide contest.
+ *<p>
+ * Regardless if the URL is absolute or not, if there are no
+ * errors, the returned URL will be canonicalized.
+ *<p>
+ * The following relative URL formats are supported:
+ * <dl>
+ * <dt><code>../</code></dt>
+ * <dd>relative to the parent directory of the external</dd>
+ * <dt><code>^/</code></dt>
+ * <dd>relative to the repository root</dd>
+ * <dt><code>//</code></dt>
+ * <dd>relative to the scheme</dd>
+ * <dt><code>/</code></dt>
+ * <dd>relative to the server's hostname</dd>
+ *<p>
+ * The <code>../<code> and ^/ relative URLs may use <code>..<code>
+ * to remove path elements up to the server root.
+ *<p>
+ * The external URL should not be canonicalized before calling
+ * this function, as otherwise the scheme relative URL
+ * '<code>//host/some/path</code>' would have been canonicalized
+ * to '<code>/host/some/path</code>' and we would not be able to
+ * match on the leading '<code>//</code>'.
+ */
+ public static String resolveExternalsUrl(ExternalItem external,
+ String reposRootUrl,
+ String parentDirUrl)
+ throws ClientException
+ {
+ return propLib.resolveExternalsUrl(
+ external, reposRootUrl, parentDirUrl);
}
}
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteFactory.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteFactory.java?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteFactory.java (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteFactory.java Tue Nov 12 10:48:49 2013
@@ -59,13 +59,15 @@ public class RemoteFactory
public RemoteFactory(String configDirectory,
String username, String password,
UserPasswordCallback prompt,
- ProgressCallback progress)
+ ProgressCallback progress,
+ ConfigEvent configHandler)
{
setConfigDirectory(configDirectory);
setUsername(username);
setPassword(password);
setPrompt(prompt);
setProgressCallback(progress);
+ setConfigEventHandler(configHandler);
}
/**
@@ -125,6 +127,16 @@ public class RemoteFactory
}
/**
+ * Set an event handler that will be called every time the
+ * configuration is loaded by the ISVNRemote objects created by
+ * this factory.
+ */
+ public void setConfigEventHandler(ConfigEvent configHandler)
+ {
+ this.configHandler = configHandler;
+ }
+
+ /**
* Open a persistent session to a repository.
* <p>
* <b>Note:</b> The URL can point to a subtree of the repository.
@@ -141,7 +153,7 @@ public class RemoteFactory
throws ClientException, SubversionException
{
return open(1, url, null, configDirectory,
- username, password, prompt, progress);
+ username, password, prompt, progress, configHandler);
}
/**
@@ -168,7 +180,7 @@ public class RemoteFactory
throw new IllegalArgumentException(
"retryAttempts must be positive");
return open(retryAttempts, url, null, configDirectory,
- username, password, prompt, progress);
+ username, password, prompt, progress, configHandler);
}
/**
@@ -195,7 +207,7 @@ public class RemoteFactory
if (reposUUID == null)
throw new IllegalArgumentException("reposUUID may not be null");
return open(1, url, reposUUID, configDirectory,
- username, password, prompt, progress);
+ username, password, prompt, progress, configHandler);
}
/**
@@ -229,7 +241,7 @@ public class RemoteFactory
throw new IllegalArgumentException(
"retryAttempts must be positive");
return open(retryAttempts, url, reposUUID, configDirectory,
- username, password, prompt, progress);
+ username, password, prompt, progress, configHandler);
}
private String configDirectory;
@@ -237,6 +249,7 @@ public class RemoteFactory
private String password;
private UserPasswordCallback prompt;
private ProgressCallback progress;
+ private ConfigEvent configHandler;
/* Native factory implementation. */
private static native ISVNRemote open(int retryAttempts,
@@ -244,6 +257,7 @@ public class RemoteFactory
String configDirectory,
String username, String password,
UserPasswordCallback prompt,
- ProgressCallback progress)
+ ProgressCallback progress,
+ ConfigEvent configHandler)
throws ClientException, SubversionException;
}
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/ConfigLib.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/ConfigLib.java?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/ConfigLib.java (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/ConfigLib.java Tue Nov 12 10:48:49 2013
@@ -54,12 +54,4 @@ public class ConfigLib
/** @see SVNUtil.isNativeCredentialsStoreEnabled */
public native boolean isNativeCredentialsStoreEnabled()
throws ClientException;
-
- /** @see SVNUtil.setConfigEventHandler */
- public native void setConfigEventHandler(ConfigEvent configHandler)
- throws ClientException;
-
- /** @see SVNUtil.setConfigEventHandler */
- public native ConfigEvent getConfigEventHandler()
- throws ClientException;
}
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/PropLib.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/PropLib.java?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/PropLib.java (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/PropLib.java Tue Nov 12 10:48:49 2013
@@ -48,7 +48,7 @@ public class PropLib
NativeResources.loadNativeLibrary();
}
- /** @see SVNUtil.canonicalizeSvnProperty */
+ /** @see SVNUtil#canonicalizeSvnProperty */
public byte[] canonicalizeNodeProperty(String name, byte[] value,
String path, NodeKind kind,
String mimeType,
@@ -75,9 +75,16 @@ public class PropLib
boolean canonicalizeUrl)
throws ClientException;
- /** @see SVNUtil.unparseExternals */
+ /** @see SVNUtil#unparseExternals */
public native byte[] unparseExternals(List<ExternalItem> items,
String parentDirectory,
boolean old_format)
throws SubversionException;
+
+
+ /** @see SVNUtil#resolveExternalsUrl */
+ public native String resolveExternalsUrl(ExternalItem external,
+ String reposRootUrl,
+ String parentDirUrl)
+ throws ClientException;
}
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java?rev=1540997&r1=1540996&r2=1540997&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java Tue Nov 12 10:48:49 2013
@@ -111,7 +111,7 @@ public class SVNRemoteTests extends SVNT
session = new RemoteFactory(
super.conf.getAbsolutePath(),
USERNAME, PASSWORD,
- new DefaultPromptUserPassword(), null)
+ new DefaultPromptUserPassword(), null, null)
.openRemoteSession(getTestRepoUrl());
}
catch (ClientException ex)
@@ -138,7 +138,7 @@ public class SVNRemoteTests extends SVNT
new RemoteFactory(
super.conf.getAbsolutePath(),
USERNAME, PASSWORD,
- new DefaultPromptUserPassword(), null)
+ new DefaultPromptUserPassword(), null, null)
.openRemoteSession(prefix + "repositorydoesnotexisthere");
}
finally
@@ -841,15 +841,24 @@ public class SVNRemoteTests extends SVNT
cat.enumerate(sec, en);
}
}
+
};
- try {
- SVNUtil.setConfigEventHandler(handler);
- ISVNRemote session = getSession();
- session.getLatestRevision();
- } finally {
- SVNUtil.setConfigEventHandler(null);
+ ISVNRemote session;
+ try
+ {
+ session = new RemoteFactory(
+ super.conf.getAbsolutePath(),
+ USERNAME, PASSWORD,
+ new DefaultPromptUserPassword(),
+ null, handler)
+ .openRemoteSession(getTestRepoUrl());
+ }
+ catch (ClientException ex)
+ {
+ throw new RuntimeException(ex);
}
+ session.getLatestRevision();
}
private static class RemoteStatusReceiver implements RemoteStatus
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=1540997&r1=1540996&r2=1540997&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 Tue Nov 12 10:48:49 2013
@@ -359,4 +359,32 @@ public class UtilTests extends SVNTests
}
assertTrue(caught_exception);
}
+
+ public void testResolveExternalsUrl() throws Throwable
+ {
+ assertEquals("http://a/b/c",
+ SVNUtil.resolveExternalsUrl(
+ new ExternalItem("x", "http://a/b/c/", null, null),
+ "http://a", "http://a/b"));
+
+ assertEquals("http://a/b/c",
+ SVNUtil.resolveExternalsUrl(
+ new ExternalItem("x", "^/b/c", null, null),
+ "http://a", "http://a/b"));
+
+ assertEquals("http://a/b/c",
+ SVNUtil.resolveExternalsUrl(
+ new ExternalItem("x", "../b/c", null, null),
+ "http://a", "http://a/b"));
+
+ assertEquals("http://a/b/c",
+ SVNUtil.resolveExternalsUrl(
+ new ExternalItem("x", "/b/c", null, null),
+ "http://a", "http://a/b"));
+
+ assertEquals("http://a/b/c",
+ SVNUtil.resolveExternalsUrl(
+ new ExternalItem("x", "//a/b/c", null, null),
+ "http://a", "http://a/b"));
+ }
}