You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by iv...@apache.org on 2015/02/09 12:23:43 UTC
svn commit: r1658362 [2/34] - in /subversion/branches/remove-log-addressing:
./ build/ build/generator/ build/generator/templates/ notes/
subversion/bindings/cxxhl/include/svncxxhl/
subversion/bindings/javahl/native/ subversion/bindings/javahl/native/j...
Modified: subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/SVNClient.cpp?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/SVNClient.cpp (original)
+++ subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/SVNClient.cpp Mon Feb 9 11:23:39 2015
@@ -339,7 +339,8 @@ void SVNClient::remove(Targets &targets,
void SVNClient::revert(StringArray &paths, svn_depth_t depth,
StringArray &changelists,
- bool clear_changelists)
+ bool clear_changelists,
+ bool metadata_only)
{
SVN::Pool subPool(pool);
@@ -352,6 +353,7 @@ void SVNClient::revert(StringArray &path
SVN_JNI_ERR(svn_client_revert3(targets.array(subPool), depth,
changelists.array(subPool),
clear_changelists,
+ metadata_only,
ctx, subPool.getPool()), );
}
@@ -1184,7 +1186,7 @@ void SVNClient::relocate(const char *fro
void SVNClient::blame(const char *path, Revision &pegRevision,
Revision &revisionStart, Revision &revisionEnd,
bool ignoreMimeType, bool includeMergedRevisions,
- BlameCallback *callback)
+ BlameCallback *callback, DiffOptions const& options)
{
SVN::Pool subPool(pool);
SVN_JNI_NULL_PTR_EX(path, "path", );
@@ -1198,7 +1200,7 @@ void SVNClient::blame(const char *path,
SVN_JNI_ERR(svn_client_blame5(
intPath.c_str(), pegRevision.revision(), revisionStart.revision(),
revisionEnd.revision(),
- svn_diff_file_options_create(subPool.getPool()), ignoreMimeType,
+ options.fileOptions(subPool), ignoreMimeType,
includeMergedRevisions, BlameCallback::callback, callback, ctx,
subPool.getPool()),
);
Modified: subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/SVNClient.h
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/SVNClient.h?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/SVNClient.h (original)
+++ subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/SVNClient.h Mon Feb 9 11:23:39 2015
@@ -82,7 +82,7 @@ class SVNClient :public SVNBase
void blame(const char *path, Revision &pegRevision,
Revision &revisionStart, Revision &revisionEnd,
bool ignoreMimeType, bool includeMergedRevisions,
- BlameCallback *callback);
+ BlameCallback *callback, DiffOptions const& options);
void relocate(const char *from, const char *to, const char *path,
bool ignoreExternals);
apr_hash_t *streamFileContent(const char *path,
@@ -161,7 +161,7 @@ class SVNClient :public SVNBase
void add(const char *path, svn_depth_t depth, bool force,
bool no_ignore, bool no_autoprops, bool add_parents);
void revert(StringArray &paths, svn_depth_t depth, StringArray &changelists,
- bool clear_changelists);
+ bool clear_changelists, bool metadata_only);
void remove(Targets &targets, CommitMessage *message, bool force,
bool keep_local, PropertyTable &revprops,
CommitCallback *callback);
Modified: subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/Utility.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/Utility.cpp?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/Utility.cpp (original)
+++ subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/Utility.cpp Mon Feb 9 11:23:39 2015
@@ -52,7 +52,10 @@ public:
const char* const safe_key =
apr_pstrmemdup(m_pool, key.c_str(), key.size() + 1);
if (!value.get())
- apr_hash_set(m_hash, safe_key, key.size(), m_default);
+ {
+ if (m_default != NULL)
+ apr_hash_set(m_hash, safe_key, key.size(), m_default);
+ }
else
{
Java::ByteArray::Contents val(value);
@@ -70,20 +73,22 @@ private:
apr_hash_t* const m_hash;
const svn_string_t* const m_default;
};
+
+typedef ::Java::ImmutableMap< ::Java::ByteArray, jbyteArray> ImmutableByteArrayMap;
} // anonymous namespace
apr_hash_t*
make_keyword_hash(::Java::Env env, jobject jkeywords, apr_pool_t* pool)
{
const svn_string_t* const empty = svn_string_create_empty(pool);
- const ::Java::Map< ::Java::ByteArray, jbyteArray> keywords(env, jkeywords);
+ const ImmutableByteArrayMap keywords(env, jkeywords);
return keywords.for_each(MapToHashIteration(empty, pool)).get();
}
apr_hash_t*
make_property_hash(::Java::Env env, jobject jproperties, apr_pool_t* pool)
{
- const ::Java::Map< ::Java::ByteArray, jbyteArray> props(env, jproperties);
+ const ImmutableByteArrayMap props(env, jproperties);
return props.for_each(MapToHashIteration(NULL, pool)).get();
}
Modified: subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_base.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_base.cpp?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_base.cpp (original)
+++ subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_base.cpp Mon Feb 9 11:23:39 2015
@@ -325,10 +325,17 @@ const char* const OutOfMemoryError::m_cl
const char* const IndexOutOfBoundsException::m_class_name =
"java/lang/IndexOutOfBoundsException";
+IndexOutOfBoundsException::ClassImpl::~ClassImpl() {}
const char* const IOException::m_class_name =
"java/io/IOException";
+const char* const IllegalArgumentException::m_class_name =
+ "java/lang/IllegalArgumentException";
+
+const char *const NoSuchElementException::m_class_name =
+ "java/util/NoSuchElementException";
+NoSuchElementException::ClassImpl::~ClassImpl() {}
// Implementation of jni_stack.hpp
Modified: subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_class_cache.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_class_cache.cpp?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_class_cache.cpp (original)
+++ subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_class_cache.cpp Mon Feb 9 11:23:39 2015
@@ -163,14 +163,20 @@ class ClassCacheImpl
return pimpl; \
}
- JNIWRAPPER_DEFINE_CACHED_CLASS(list, BaseList);
- JNIWRAPPER_DEFINE_CACHED_CLASS(array_list, BaseMutableList);
-
- JNIWRAPPER_DEFINE_CACHED_CLASS(map, BaseMap);
- JNIWRAPPER_DEFINE_CACHED_CLASS(set, BaseMap::Set);
- JNIWRAPPER_DEFINE_CACHED_CLASS(iterator, BaseMap::Iterator);
- JNIWRAPPER_DEFINE_CACHED_CLASS(map_entry, BaseMap::Entry);
- JNIWRAPPER_DEFINE_CACHED_CLASS(hash_map, BaseMutableMap);
+ JNIWRAPPER_DEFINE_CACHED_CLASS(exc_index_out_of_bounds,
+ IndexOutOfBoundsException);
+ JNIWRAPPER_DEFINE_CACHED_CLASS(exc_no_such_element,
+ NoSuchElementException);
+
+ JNIWRAPPER_DEFINE_CACHED_CLASS(iterator, BaseIterator);
+
+ JNIWRAPPER_DEFINE_CACHED_CLASS(list, BaseImmutableList);
+ JNIWRAPPER_DEFINE_CACHED_CLASS(array_list, BaseList);
+
+ JNIWRAPPER_DEFINE_CACHED_CLASS(map, BaseImmutableMap);
+ JNIWRAPPER_DEFINE_CACHED_CLASS(set, BaseImmutableMap::Set);
+ JNIWRAPPER_DEFINE_CACHED_CLASS(map_entry, BaseImmutableMap::Entry);
+ JNIWRAPPER_DEFINE_CACHED_CLASS(hash_map, BaseMap);
JNIWRAPPER_DEFINE_CACHED_CLASS(input_stream, InputStream);
JNIWRAPPER_DEFINE_CACHED_CLASS(output_stream, OutputStream);
@@ -279,6 +285,9 @@ JNIWRAPPER_IMPL_CLASS_CACHE_ACCESSOR(cla
JNIWRAPPER_IMPL_CLASS_CACHE_ACCESSOR(throwable);
JNIWRAPPER_IMPL_CLASS_CACHE_ACCESSOR(string);
+JNIWRAPPER_IMPL_CLASS_CACHE_ACCESSOR(exc_index_out_of_bounds);
+JNIWRAPPER_IMPL_CLASS_CACHE_ACCESSOR(exc_no_such_element);
+
JNIWRAPPER_IMPL_CLASS_CACHE_ACCESSOR(list);
JNIWRAPPER_IMPL_CLASS_CACHE_ACCESSOR(array_list);
Modified: subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_exception.hpp
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_exception.hpp?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_exception.hpp (original)
+++ subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_exception.hpp Mon Feb 9 11:23:39 2015
@@ -264,6 +264,23 @@ public:
{}
private:
+ /**
+ * This object's implementation details.
+ */
+ class ClassImpl : public Object::ClassImpl
+ {
+ friend class ClassCacheImpl;
+
+ protected:
+ explicit ClassImpl(Env env, jclass cls)
+ : Object::ClassImpl(env, cls)
+ {}
+
+ public:
+ virtual ~ClassImpl();
+ };
+
+ friend class ClassCacheImpl;
static const char* const m_class_name;
};
@@ -286,6 +303,62 @@ private:
static const char* const m_class_name;
};
+/**
+ * Generator class for exceptions of type @c java.lang.IllegalArgumentException.
+ *
+ * @since New in 1.9.
+ */
+class IllegalArgumentException : public Exception
+{
+public:
+ /**
+ * Constructs an exception generator object.
+ */
+ explicit IllegalArgumentException(Env env)
+ : Exception(env, m_class_name)
+ {}
+
+private:
+ static const char* const m_class_name;
+};
+
+/**
+ * Generator class for exceptions of type
+ * @c java.util.NoSuchElementException.
+ *
+ * @since New in 1.9.
+ */
+class NoSuchElementException : public Exception
+{
+public:
+ /**
+ * Constructs an exception generator object.
+ */
+ explicit NoSuchElementException(Env env)
+ : Exception(env, m_class_name)
+ {}
+
+private:
+ /**
+ * This object's implementation details.
+ */
+ class ClassImpl : public Object::ClassImpl
+ {
+ friend class ClassCacheImpl;
+
+ protected:
+ explicit ClassImpl(Env env, jclass cls)
+ : Object::ClassImpl(env, cls)
+ {}
+
+ public:
+ virtual ~ClassImpl();
+ };
+
+ friend class ClassCacheImpl;
+ static const char* const m_class_name;
+};
+
} // namespace Java
-#endif // SVN_JAVAHL_JNIWRAPPER_ENV_HPP
+#endif // SVN_JAVAHL_JNIWRAPPER_EXCEPTION_HPP
Modified: subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_list.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_list.cpp?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_list.cpp (original)
+++ subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_list.cpp Mon Feb 9 11:23:39 2015
@@ -21,54 +21,65 @@
* @endcopyright
*/
+#include <stdexcept>
+#include <string>
+
#include "jni_list.hpp"
+#include "svn_private_config.h"
+
namespace Java {
-// Class Java::BaseList
+// Class Java::BaseImmutableList
-const char* const BaseList::m_class_name = "java/util/List";
+const char* const BaseImmutableList::m_class_name = "java/util/List";
-BaseList::ClassImpl::ClassImpl(Env env, jclass cls)
+BaseImmutableList::ClassImpl::ClassImpl(Env env, jclass cls)
: Object::ClassImpl(env, cls),
m_mid_size(env.GetMethodID(cls, "size", "()I")),
- m_mid_get(env.GetMethodID(cls, "get", "(I)Ljava/lang/Object;"))
+ m_mid_get(env.GetMethodID(cls, "get", "(I)Ljava/lang/Object;")),
+ m_mid_add(env.GetMethodID(cls, "add", "(Ljava/lang/Object;)Z")),
+ m_mid_clear(env.GetMethodID(cls, "clear", "()V")),
+ m_mid_iter(env.GetMethodID(cls, "listIterator", "()Ljava/util/ListIterator;"))
{}
-BaseList::ClassImpl::~ClassImpl() {}
+BaseImmutableList::ClassImpl::~ClassImpl() {}
-BaseList::ovector
-BaseList::convert_to_vector(Env env, jobject jlist)
+jobject BaseImmutableList::operator[](jint index) const
{
- const ClassImpl* pimpl =
- dynamic_cast<const ClassImpl*>(ClassCache::get_list(env));
- const jint length = env.CallIntMethod(jlist, pimpl->m_mid_size);
-
- if (!length)
- return ovector();
-
- ovector contents(length);
- ovector::iterator it;
- jint i;
- for (i = 0, it = contents.begin(); it != contents.end(); ++it, ++i)
- *it = env.CallObjectMethod(jlist, pimpl->m_mid_get, i);
- return contents;
+ try
+ {
+ return m_env.CallObjectMethod(m_jthis, impl().m_mid_get, index);
+ }
+ catch (const SignalExceptionThrown&)
+ {
+ // Just rethrow if it's not an IndexOutOfBoundsException.
+ if (!m_env.IsInstanceOf(
+ m_env.ExceptionOccurred(),
+ ClassCache::get_exc_index_out_of_bounds(m_env)->get_class()))
+ throw;
+
+ m_env.ExceptionClear();
+ std::string msg(_("List index out of bounds: "));
+ msg += index;
+ throw std::out_of_range(msg.c_str());
+ }
}
+BaseImmutableList::Iterator BaseImmutableList::get_iterator() const
+{
+ return Iterator(m_env, m_env.CallObjectMethod(m_jthis, impl().m_mid_iter));
+}
-// Class Java::BaseMutableList
+// Class Java::BaseList
-const char* const BaseMutableList::m_class_name = "java/util/ArrayList";
+const char* const BaseList::m_class_name = "java/util/ArrayList";
-BaseMutableList::ClassImpl::ClassImpl(Env env, jclass cls)
- : Object::ClassImpl(env, cls),
- m_mid_ctor(env.GetMethodID(cls, "<init>", "(I)V")),
- m_mid_add(env.GetMethodID(cls, "add", "(Ljava/lang/Object;)Z")),
- m_mid_clear(env.GetMethodID(cls, "clear", "()V")),
- m_mid_get(env.GetMethodID(cls, "get", "(I)Ljava/lang/Object;")),
- m_mid_size(env.GetMethodID(cls, "size", "()I"))
+BaseList::ClassImpl::ClassImpl(Env env, jclass cls)
+ : BaseImmutableList::ClassImpl(env, cls),
+ m_mid_ctor(env.GetMethodID(cls, "<init>", "(I)V"))
{}
-BaseMutableList::ClassImpl::~ClassImpl() {}
+BaseList::ClassImpl::~ClassImpl() {}
} // namespace Java
Modified: subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_list.hpp
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_list.hpp?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_list.hpp (original)
+++ subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_list.hpp Mon Feb 9 11:23:39 2015
@@ -24,56 +24,89 @@
#ifndef SVN_JAVAHL_JNIWRAPPER_LIST_HPP
#define SVN_JAVAHL_JNIWRAPPER_LIST_HPP
-#include <algorithm>
-#include <vector>
-
#include "jni_env.hpp"
#include "jni_object.hpp"
+#include "jni_iterator.hpp"
namespace Java {
/**
* Non-template base for an immutable type-safe Java list.
*
- * Converts the list to a @c std::vector of @c jobject references.
- *
* @since New in 1.9.
*/
-class BaseList : public Object
+class BaseImmutableList : public Object
{
- typedef std::vector<jobject> ovector;
-
public:
/**
* Returns the number of elements in the list.
*/
jint length() const
{
- return jint(m_contents.size());
+ return m_env.CallIntMethod(m_jthis, impl().m_mid_size);
+ }
+
+ /**
+ * Checks if the list is empty.
+ */
+ bool is_empty() const
+ {
+ return (length() == 0);
}
protected:
/**
- * Constructs the list wrapper, converting the contents to an
- * @c std::vector.
+ * Constructs the list wrapper
*/
- explicit BaseList(Env env, jobject jlist)
- : Object(env, ClassCache::get_list(env), jlist),
- m_contents(convert_to_vector(env, m_jthis))
+ explicit BaseImmutableList(Env env, jobject jlist)
+ : Object(env, ClassCache::get_list(env), jlist)
{}
/**
- * Returns the object reference at @a index.
- * @throw std::out_of_range if the index value is not valid.
+ * Constructor used by BaseList
*/
- jobject operator[](jint index) const
+ explicit BaseImmutableList(Env env, const Object::ClassImpl* pimpl)
+ : Object(env, pimpl)
+ {}
+
+ /**
+ * Clears the contents of the list.
+ */
+ void clear()
{
- return m_contents[ovector::size_type(index)];
+ m_env.CallVoidMethod(m_jthis, impl().m_mid_clear);
}
- const ovector m_contents;
+ /**
+ * Appends @a obj to the end of the list.
+ */
+ void add(jobject obj)
+ {
+ m_env.CallVoidMethod(m_jthis, impl().m_mid_add, obj);
+ }
+
+ /**
+ * Returns the object reference at @a index.
+ * @throw std::out_of_range if the index value is not valid.
+ */
+ jobject operator[](jint index) const;
+
+ /**
+ * Iterator used by subclasses.
+ */
+ class Iterator : public BaseIterator
+ {
+ friend class BaseImmutableList;
+ explicit Iterator(Env env, jobject jiterator)
+ : BaseIterator(env, jiterator)
+ {}
+ };
+
+ /**
+ * Returns an iterator instance.
+ */
+ Iterator get_iterator() const;
-private:
/**
* This object's implementation details.
*/
@@ -89,11 +122,15 @@ private:
const MethodID m_mid_size;
const MethodID m_mid_get;
+ const MethodID m_mid_add;
+ const MethodID m_mid_clear;
+ const MethodID m_mid_iter;
};
+private:
+ friend class Iterator;
friend class ClassCacheImpl;
static const char* const m_class_name;
- static ovector convert_to_vector(Env env, jobject jlist);
const ClassImpl& impl() const
{
@@ -107,15 +144,14 @@ private:
* @since New in 1.9.
*/
template <typename T, typename NativeT=jobject>
-class List : public BaseList
+class ImmutableList : public BaseImmutableList
{
public:
/**
- * Constructs the list wrapper, converting the contents to an
- * @c std::vector.
+ * Constructs the list wrapper.
*/
- explicit List(Env env, jobject jlist)
- : BaseList(env, jlist)
+ explicit ImmutableList(Env env, jobject jlist)
+ : BaseImmutableList(env, jlist)
{}
/**
@@ -124,7 +160,7 @@ public:
*/
T operator[](jint index) const
{
- return T(m_env, NativeT(BaseList::operator[](index)));
+ return T(m_env, NativeT(BaseImmutableList::operator[](index)));
}
/**
@@ -135,29 +171,11 @@ public:
template<typename F>
F for_each(F function) const
{
- const FunctorAdapter<F> adapter(m_env, function);
- std::for_each(m_contents.begin(), m_contents.end(), adapter);
+ Iterator iter(get_iterator());
+ while (iter.has_next())
+ function(T(m_env, NativeT(iter.next())));
return function;
}
-
-private:
- template<typename F>
- struct FunctorAdapter
- {
- explicit FunctorAdapter(const Env& env, F& function)
- : m_env(env),
- m_function(function)
- {}
-
- void operator()(const jobject& obj) const
- {
- const T item(m_env, NativeT(obj));
- m_function(item);
- }
-
- const Env& m_env;
- F& m_function;
- };
};
/**
@@ -165,7 +183,7 @@ private:
*
* @since New in 1.9.
*/
-class BaseMutableList : public Object
+class BaseList : public BaseImmutableList
{
public:
/**
@@ -173,66 +191,40 @@ public:
*/
void clear()
{
- m_env.CallVoidMethod(m_jthis, impl().m_mid_clear);
- }
-
- /**
- * Returns the number of elements in the list.
- */
- jint length() const
- {
- return m_env.CallIntMethod(m_jthis, impl().m_mid_size);
- }
-
- /**
- * Checks if the list is empty.
- */
- bool is_empty() const
- {
- return (length() == 0);
+ BaseImmutableList::clear();
}
protected:
/**
- * Constructs the list wrapper, deriving the class from @a jlist.
+ * Constructs the list wrapper, treating @a jlist as a @c java.util.List.
*/
- explicit BaseMutableList(Env env, jobject jlist)
- : Object(env, ClassCache::get_array_list(env), jlist)
+ explicit BaseList(Env env, jobject jlist)
+ : BaseImmutableList(env, jlist)
{}
/**
* Constructs and wraps an empty list of type @c java.util.ArrayList
* with initial allocation size @a length.
*/
- explicit BaseMutableList(Env env, jint length)
- : Object(env, ClassCache::get_array_list(env))
+ explicit BaseList(Env env, jint length)
+ : BaseImmutableList(env, ClassCache::get_array_list(env))
{
set_this(env.NewObject(get_class(), impl().m_mid_ctor, length));
}
-
/**
* Appends @a obj to the end of the list.
*/
void add(jobject obj)
{
- m_env.CallBooleanMethod(m_jthis, impl().m_mid_add, obj);
- }
-
- /**
- * Returns the object reference at @a index.
- * @note Throws a Java exception if the index value is not valid.
- */
- jobject operator[](jint index) const
- {
- return m_env.CallObjectMethod(m_jthis, impl().m_mid_get, index);
+ BaseImmutableList::add(obj);
}
private:
/**
* This object's implementation details.
*/
- class ClassImpl : public Object::ClassImpl
+ class ClassImpl : public BaseImmutableList::ClassImpl
{
friend class ClassCacheImpl;
@@ -243,10 +235,6 @@ private:
virtual ~ClassImpl();
const MethodID m_mid_ctor;
- const MethodID m_mid_add;
- const MethodID m_mid_clear;
- const MethodID m_mid_get;
- const MethodID m_mid_size;
};
friend class ClassCacheImpl;
@@ -264,39 +252,53 @@ private:
* @since New in 1.9.
*/
template <typename T, typename NativeT=jobject>
-class MutableList : public BaseMutableList
+class List : public BaseList
{
public:
/**
* Constructs the list wrapper, deriving the class from @a jlist.
*/
- explicit MutableList(Env env, jobject jlist)
- : BaseMutableList(env, jlist)
+ explicit List(Env env, jobject jlist)
+ : BaseList(env, jlist)
{}
/**
* Constructs and wraps an empty list of type @c java.util.ArrayList
* with initial allocation size @a length.
*/
- explicit MutableList(Env env, jint length_ = 0)
- : BaseMutableList(env, length_)
+ explicit List(Env env, jint length_ = 0)
+ : BaseList(env, length_)
{}
/**
+ * Returns a wrapper object for the object reference at @a index.
+ * @throw std::out_of_range if the index value is not valid.
+ */
+ T operator[](jint index) const
+ {
+ return T(m_env, NativeT(BaseList::operator[](index)));
+ }
+
+ /**
* Appends @a obj to the end of the list.
*/
void add(const T& obj)
{
- BaseMutableList::add(obj.get());
+ BaseList::add(obj.get());
}
/**
- * Returns a wrapper object for the object reference at @a index.
- * @note Throws a Java exception if the index value is not valid.
+ * Iterates over the items in the list, calling @a function for
+ * each item.
+ * @see std::for_each
*/
- T operator[](jint index) const
+ template<typename F>
+ F for_each(F function) const
{
- return T(m_env, NativeT(BaseMutableList::operator[](index)));
+ Iterator iter(get_iterator());
+ while (iter.has_next())
+ function(T(m_env, NativeT(iter.next())));
+ return function;
}
};
Modified: subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_object.hpp
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_object.hpp?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_object.hpp (original)
+++ subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_object.hpp Mon Feb 9 11:23:39 2015
@@ -171,6 +171,9 @@ public:
JNIWRAPPER_DECLARE_CACHED_CLASS_ACCESSOR(throwable);
JNIWRAPPER_DECLARE_CACHED_CLASS_ACCESSOR(string);
+ JNIWRAPPER_DECLARE_CACHED_CLASS_ACCESSOR(exc_index_out_of_bounds);
+ JNIWRAPPER_DECLARE_CACHED_CLASS_ACCESSOR(exc_no_such_element);
+
JNIWRAPPER_DECLARE_CACHED_CLASS_ACCESSOR(list);
JNIWRAPPER_DECLARE_CACHED_CLASS_ACCESSOR(array_list);
Modified: subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_string_map.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_string_map.cpp?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_string_map.cpp (original)
+++ subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_string_map.cpp Mon Feb 9 11:23:39 2015
@@ -30,123 +30,81 @@
namespace Java {
-// Class Java::BaseMap
+// Class Java::BaseImmutableMap
-const char* const BaseMap::m_class_name = "java/util/Map";
+const char* const BaseImmutableMap::m_class_name = "java/util/Map";
-BaseMap::ClassImpl::ClassImpl(Env env, jclass cls)
+BaseImmutableMap::ClassImpl::ClassImpl(Env env, jclass cls)
: Object::ClassImpl(env, cls),
+ m_mid_put(env.GetMethodID(cls, "put",
+ "(Ljava/lang/Object;Ljava/lang/Object;)"
+ "Ljava/lang/Object;")),
+ m_mid_clear(env.GetMethodID(cls, "clear", "()V")),
+ m_mid_has_key(env.GetMethodID(cls, "containsKey",
+ "(Ljava/lang/Object;)Z")),
+ m_mid_get(env.GetMethodID(cls, "get",
+ "(Ljava/lang/Object;)Ljava/lang/Object;")),
m_mid_size(env.GetMethodID(cls, "size", "()I")),
m_mid_entry_set(env.GetMethodID(cls, "entrySet", "()Ljava/util/Set;"))
{}
-BaseMap::ClassImpl::~ClassImpl() {}
-
-const char* const BaseMap::Set::m_class_name = "java/util/Set";
-
-BaseMap::Set::ClassImpl::ClassImpl(Env env, jclass cls)
- : Object::ClassImpl(env, cls),
- m_mid_iterator(env.GetMethodID(cls, "iterator",
- "()Ljava/util/Iterator;"))
-{}
-
-BaseMap::Set::ClassImpl::~ClassImpl() {}
+BaseImmutableMap::ClassImpl::~ClassImpl() {}
-const char* const BaseMap::Iterator::m_class_name = "java/util/Iterator";
+jobject BaseImmutableMap::operator[](const std::string& index) const
+{
+ const String key(m_env, index);
+ if (!m_env.CallBooleanMethod(m_jthis, impl().m_mid_has_key, key.get()))
+ {
+ std::string msg(_("Map does not contain key: "));
+ msg += index;
+ throw std::out_of_range(msg.c_str());
+ }
+ return m_env.CallObjectMethod(m_jthis, impl().m_mid_get, key.get());
+}
-BaseMap::Iterator::ClassImpl::ClassImpl(Env env, jclass cls)
- : Object::ClassImpl(env, cls),
- m_mid_has_next(env.GetMethodID(cls, "hasNext", "()Z")),
- m_mid_next(env.GetMethodID(cls, "next", "()Ljava/lang/Object;"))
-{}
+BaseImmutableMap::Iterator BaseImmutableMap::get_iterator() const
+{
+ const jobject jentry_set =
+ m_env.CallObjectMethod(m_jthis, impl().m_mid_entry_set);
+ const jobject jiterator =
+ m_env.CallObjectMethod(jentry_set, Set::impl(m_env).m_mid_iterator);
+ return Iterator(m_env, jiterator);
+}
-BaseMap::Iterator::ClassImpl::~ClassImpl() {}
+// Class Java::BaseImmutableMap::Entry
-const char* const BaseMap::Entry::m_class_name = "java/util/Map$Entry";
+const char* const BaseImmutableMap::Entry::m_class_name = "java/util/Map$Entry";
-BaseMap::Entry::ClassImpl::ClassImpl(Env env, jclass cls)
+BaseImmutableMap::Entry::ClassImpl::ClassImpl(Env env, jclass cls)
: Object::ClassImpl(env, cls),
m_mid_get_key(env.GetMethodID(cls, "getKey", "()Ljava/lang/Object;")),
m_mid_get_value(env.GetMethodID(cls, "getValue", "()Ljava/lang/Object;"))
{}
-BaseMap::Entry::ClassImpl::~ClassImpl() {}
+BaseImmutableMap::Entry::ClassImpl::~ClassImpl() {}
+// Class Java::BaseImmutableMap::Set
-jobject BaseMap::operator[](const std::string& index) const
-{
- somap::const_iterator it = m_contents.find(index);
- if (it == m_contents.end())
- {
- std::string msg(_("Map does not contain key: "));
- msg += index;
- throw std::out_of_range(msg.c_str());
- }
- return it->second;
-}
+const char* const BaseImmutableMap::Set::m_class_name = "java/util/Set";
-BaseMap::somap BaseMap::convert_to_map(Env env, jobject jmap)
-{
- const ClassImpl* pimpl =
- dynamic_cast<const ClassImpl*>(ClassCache::get_map(env));
+BaseImmutableMap::Set::ClassImpl::ClassImpl(Env env, jclass cls)
+ : Object::ClassImpl(env, cls),
+ m_mid_iterator(env.GetMethodID(cls, "iterator",
+ "()Ljava/util/Iterator;"))
+{}
- if (!env.CallIntMethod(jmap, pimpl->m_mid_size))
- return somap();
+BaseImmutableMap::Set::ClassImpl::~ClassImpl() {}
- // Get an iterator over the map's entry set
- const jobject entries = env.CallObjectMethod(jmap, pimpl->m_mid_entry_set);
- const jobject iterator = env.CallObjectMethod(entries,
- Set::impl(env).m_mid_iterator);
-
- const Iterator::ClassImpl& iterimpl = Iterator::impl(env);
- const Entry::ClassImpl& entimpl = Entry::impl(env);
-
- // Yterate over the map, filling the native map
- somap contents;
- while (env.CallBooleanMethod(iterator, iterimpl.m_mid_has_next))
- {
- const jobject entry =
- env.CallObjectMethod(iterator, iterimpl.m_mid_next);
- const String keystr(
- env, jstring(env.CallObjectMethod(entry, entimpl.m_mid_get_key)));
- const jobject value(
- env.CallObjectMethod(entry, entimpl.m_mid_get_value));
- const String::Contents key(keystr);
- contents.insert(somap::value_type(key.c_str(), value));
- }
- return contents;
-}
-// Class Java::BaseMutableMap
+// Class Java::BaseMap
-const char* const BaseMutableMap::m_class_name = "java/util/HashMap";
+const char* const BaseMap::m_class_name = "java/util/HashMap";
-BaseMutableMap::ClassImpl::ClassImpl(Env env, jclass cls)
- : Object::ClassImpl(env, cls),
- m_mid_ctor(env.GetMethodID(cls, "<init>", "(I)V")),
- m_mid_put(env.GetMethodID(cls, "put",
- "(Ljava/lang/Object;Ljava/lang/Object;)"
- "Ljava/lang/Object;")),
- m_mid_clear(env.GetMethodID(cls, "clear", "()V")),
- m_mid_has_key(env.GetMethodID(cls, "containsKey",
- "(Ljava/lang/Object;)Z")),
- m_mid_get(env.GetMethodID(cls, "get",
- "(Ljava/lang/Object;)Ljava/lang/Object;")),
- m_mid_size(env.GetMethodID(cls, "size", "()I"))
+BaseMap::ClassImpl::ClassImpl(Env env, jclass cls)
+ : BaseImmutableMap::ClassImpl(env, cls),
+ m_mid_ctor(env.GetMethodID(cls, "<init>", "(I)V"))
{}
-BaseMutableMap::ClassImpl::~ClassImpl() {}
-
-jobject BaseMutableMap::operator[](const std::string& index) const
-{
- const String key(m_env, index);
- if (!m_env.CallBooleanMethod(m_jthis, impl().m_mid_has_key, key.get()))
- {
- std::string msg(_("Map does not contain key: "));
- msg += index;
- throw std::out_of_range(msg.c_str());
- }
- return m_env.CallObjectMethod(m_jthis, impl().m_mid_get, key.get());
-}
+BaseMap::ClassImpl::~ClassImpl() {}
} // namespace Java
Modified: subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_string_map.hpp
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_string_map.hpp?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_string_map.hpp (original)
+++ subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/jniwrapper/jni_string_map.hpp Mon Feb 9 11:23:39 2015
@@ -24,54 +24,76 @@
#ifndef SVN_JAVAHL_JNIWRAPPER_STRING_MAP_HPP
#define SVN_JAVAHL_JNIWRAPPER_STRING_MAP_HPP
-#include <map>
#include <string>
-#include <algorithm>
#include "jni_env.hpp"
#include "jni_object.hpp"
+#include "jni_iterator.hpp"
namespace Java {
/**
* Non-template base for an immutable type-safe Java map with String keys.
*
- * Converts the map to a @c std::map containing @c jobject references.
- *
* @since New in 1.9.
*/
-class BaseMap : public Object
+class BaseImmutableMap : public Object
{
- typedef std::map<std::string, jobject> somap;
-
public:
/**
* Returns the number of elements in the map.
*/
jint length() const
{
- return jint(m_contents.size());
+ return m_env.CallIntMethod(m_jthis, impl().m_mid_size);
+ }
+
+ /**
+ * Checks if the map is empty.
+ */
+ bool is_empty() const
+ {
+ return (length() == 0);
}
protected:
/**
- * Constructs the map wrapper, converting the contents to an
- * @c std::map.
+ * Constructs the map wrapper.
*/
- explicit BaseMap(Env env, jobject jmap)
- : Object(env, ClassCache::get_map(env), jmap),
- m_contents(convert_to_map(env, m_jthis))
+ explicit BaseImmutableMap(Env env, jobject jmap)
+ : Object(env, ClassCache::get_map(env), jmap)
{}
/**
+ * Constructor used by BaseMap.
+ */
+ explicit BaseImmutableMap(Env env, const Object::ClassImpl* pimpl)
+ : Object(env, pimpl)
+ {}
+
+ /**
+ * Clears the contents of the map.
+ */
+ void clear()
+ {
+ m_env.CallVoidMethod(m_jthis, impl().m_mid_clear);
+ }
+
+ /**
+ * Inserts @a obj identified by @a key into the map.
+ */
+ void put(const std::string& key, jobject obj)
+ {
+ m_env.CallObjectMethod(m_jthis, impl().m_mid_put,
+ String(m_env, key).get(), obj);
+ }
+
+ /**
* Returns the object reference identified by @a index.
* @throw std::out_of_range if there is no such element.
*/
jobject operator[](const std::string& index) const;
- const somap m_contents;
-
-private:
/**
* This object's implementation details.
*/
@@ -85,6 +107,10 @@ private:
public:
virtual ~ClassImpl();
+ const MethodID m_mid_put;
+ const MethodID m_mid_clear;
+ const MethodID m_mid_has_key;
+ const MethodID m_mid_get;
const MethodID m_mid_size;
const MethodID m_mid_entry_set;
};
@@ -96,35 +122,38 @@ private:
friend class ClassCacheImpl;
static const char* const m_class_name;
- static somap convert_to_map(Env env, jobject jmap);
- struct Set
+ class Iterator : public BaseIterator
{
- /**
- * This object's implementation details.
- */
- class ClassImpl : public Object::ClassImpl
- {
- friend class ClassCacheImpl;
+ friend class BaseImmutableMap;
+ explicit Iterator(Env env, jobject jiterator)
+ : BaseIterator(env, jiterator)
+ {}
+ };
- protected:
- explicit ClassImpl(Env env, jclass cls);
+ Iterator get_iterator() const;
- public:
- virtual ~ClassImpl();
+ class Entry : public Object
+ {
+ public:
+ explicit Entry(Env env, jobject jentry)
+ : Object(env, ClassCache::get_map_entry(env), jentry)
+ {}
- const MethodID m_mid_iterator;
- };
+ const std::string key() const
+ {
+ const jstring jkey =
+ jstring(m_env.CallObjectMethod(m_jthis, impl().m_mid_get_key));
+ const String::Contents key(String(m_env, jkey));
+ return std::string(key.c_str());
+ }
- static const char* const m_class_name;
- static const ClassImpl& impl(Env env)
+ jobject value() const
{
- return *dynamic_cast<const ClassImpl*>(ClassCache::get_set(env));
+ return m_env.CallObjectMethod(m_jthis, impl().m_mid_get_value);
}
- };
- struct Iterator
- {
+ private:
/**
* This object's implementation details.
*/
@@ -138,18 +167,20 @@ private:
public:
virtual ~ClassImpl();
- const MethodID m_mid_has_next;
- const MethodID m_mid_next;
+ const MethodID m_mid_get_key;
+ const MethodID m_mid_get_value;
};
+ friend class ClassCacheImpl;
static const char* const m_class_name;
- static const ClassImpl& impl(Env env)
+ const ClassImpl& impl() const
{
- return *dynamic_cast<const ClassImpl*>(ClassCache::get_iterator(env));
+ return *dynamic_cast<const ClassImpl*>(m_impl);
}
};
- struct Entry
+private:
+ struct Set
{
/**
* This object's implementation details.
@@ -164,14 +195,13 @@ private:
public:
virtual ~ClassImpl();
- const MethodID m_mid_get_key;
- const MethodID m_mid_get_value;
+ const MethodID m_mid_iterator;
};
static const char* const m_class_name;
static const ClassImpl& impl(Env env)
{
- return *dynamic_cast<const ClassImpl*>(ClassCache::get_map_entry(env));
+ return *dynamic_cast<const ClassImpl*>(ClassCache::get_set(env));
}
};
};
@@ -182,15 +212,15 @@ private:
* @since New in 1.9.
*/
template <typename T, typename NativeT=jobject>
-class Map : public BaseMap
+class ImmutableMap : public BaseImmutableMap
{
public:
/**
* Constructs the map wrapper, converting the contents to an
* @c std::map.
*/
- explicit Map(Env env, jobject jmap)
- : BaseMap(env, jmap)
+ explicit ImmutableMap(Env env, jobject jmap)
+ : BaseImmutableMap(env, jmap)
{}
/**
@@ -199,7 +229,7 @@ public:
*/
T operator[](const std::string& index) const
{
- return T(m_env, NativeT(BaseMap::operator[](index)));
+ return T(m_env, NativeT(BaseImmutableMap::operator[](index)));
}
/**
@@ -207,37 +237,22 @@ public:
* each item.
* @see std::for_each
* @note Unlike std::for_each, which invokes the functor with a
- * single @c value_type argument, this iterator adapts it to cal
- * @a function with separate @c const references to the key and
- * value.
+ * single @c value_type argument, this iterator calls
+ * @a function with separate @c const references to the key
+ * and value.
*/
template<typename F>
F for_each(F function) const
{
- const FunctorAdapter<F> adapter(m_env, function);
- std::for_each(m_contents.begin(), m_contents.end(), adapter);
+ Iterator iter(get_iterator());
+ while (iter.has_next())
+ {
+ Entry entry(m_env, iter.next());
+ const std::string& key(entry.key());
+ function(key, T(m_env, NativeT(entry.value())));
+ }
return function;
}
-
-private:
- template<typename F>
- struct FunctorAdapter
- {
- explicit FunctorAdapter(const Env& env, F& function)
- : m_env(env),
- m_function(function)
- {}
-
- void operator()(const std::pair<std::string, jobject>& item) const
- {
- const std::string& key(item.first);
- const T value(m_env, NativeT(item.second));
- m_function(key, value);
- }
-
- const Env& m_env;
- F& m_function;
- };
};
/**
@@ -245,7 +260,7 @@ private:
*
* @since New in 1.9.
*/
-class BaseMutableMap : public Object
+class BaseMap : public BaseImmutableMap
{
public:
/**
@@ -253,64 +268,32 @@ public:
*/
void clear()
{
- m_env.CallVoidMethod(m_jthis, impl().m_mid_clear);
- }
-
- /**
- * Returns the number of elements in the map.
- */
- jint length() const
- {
- return m_env.CallIntMethod(m_jthis, impl().m_mid_size);
- }
-
- /**
- * Checks if the map is empty.
- */
- bool is_empty() const
- {
- return (length() == 0);
+ BaseImmutableMap::clear();
}
protected:
/**
- * Constructs the map wrapper, deriving the class from @a jmap.
+ * Constructs the map wrapper, treating @a jmap as a @c java.util.Map.
*/
- explicit BaseMutableMap(Env env, jobject jmap)
- : Object(env, ClassCache::get_hash_map(env), jmap)
+ explicit BaseMap(Env env, jobject jmap)
+ : BaseImmutableMap(env, jmap)
{}
/**
* Constructs and wraps an empty map of type @c java.util.HashMap
* with initial allocation size @a length.
*/
- explicit BaseMutableMap(Env env, jint length)
- : Object(env, ClassCache::get_hash_map(env))
+ explicit BaseMap(Env env, jint length)
+ : BaseImmutableMap(env, ClassCache::get_hash_map(env))
{
set_this(env.NewObject(get_class(), impl().m_mid_ctor, length));
}
-
- /**
- * Inserts @a obj identified by @a key into the map.
- */
- void put(const std::string& key, jobject obj)
- {
- m_env.CallObjectMethod(m_jthis, impl().m_mid_put,
- String(m_env, key).get(), obj);
- }
-
- /**
- * Returns the object reference identified by @a index.
- * @throw std::out_of_range if there is no such element.
- */
- jobject operator[](const std::string& index) const;
-
private:
/**
* This object's implementation details.
*/
- class ClassImpl : public Object::ClassImpl
+ class ClassImpl : public BaseImmutableMap::ClassImpl
{
friend class ClassCacheImpl;
@@ -321,11 +304,6 @@ private:
virtual ~ClassImpl();
const MethodID m_mid_ctor;
- const MethodID m_mid_put;
- const MethodID m_mid_clear;
- const MethodID m_mid_has_key;
- const MethodID m_mid_get;
- const MethodID m_mid_size;
};
const ClassImpl& impl() const
@@ -343,22 +321,22 @@ private:
* @since New in 1.9.
*/
template <typename T, typename NativeT=jobject>
-class MutableMap : public BaseMutableMap
+class Map : public BaseMap
{
public:
/**
* Constructs the map wrapper, deriving the class from @a jmap.
*/
- explicit MutableMap(Env env, jobject jmap)
- : BaseMutableMap(env, jmap)
+ explicit Map(Env env, jobject jmap)
+ : BaseMap(env, jmap)
{}
/**
* Constructs and wraps an empty map of type @c java.util.HashMap
* with initial allocation size @a length.
*/
- explicit MutableMap(Env env, jint length = 0)
- : BaseMutableMap(env, length)
+ explicit Map(Env env, jint length = 0)
+ : BaseMap(env, length)
{}
/**
@@ -366,7 +344,7 @@ public:
*/
void put(const std::string& key, const T& obj)
{
- BaseMutableMap::put(key, obj.get());
+ BaseMap::put(key, obj.get());
}
/**
@@ -375,7 +353,29 @@ public:
*/
T operator[](const std::string& index) const
{
- return T(m_env, NativeT(BaseMutableMap::operator[](index)));
+ return T(m_env, NativeT(BaseMap::operator[](index)));
+ }
+
+ /**
+ * Iterates over the items in the map, calling @a function for
+ * each item.
+ * @see std::for_each
+ * @note Unlike std::for_each, which invokes the functor with a
+ * single @c value_type argument, this iterator calls
+ * @a function with separate @c const references to the key
+ * and value.
+ */
+ template<typename F>
+ F for_each(F function) const
+ {
+ Iterator iter(get_iterator());
+ while (iter.has_next())
+ {
+ Entry entry(m_env, iter.next());
+ const std::string& key(entry.key());
+ function(key, T(m_env, NativeT(entry.value())));
+ }
+ return function;
}
};
Modified: subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp (original)
+++ subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp Mon Feb 9 11:23:39 2015
@@ -439,7 +439,7 @@ Java_org_apache_subversion_javahl_SVNCli
JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNClient_revert
(JNIEnv *env, jobject jthis, jobject jpaths, jobject jdepth,
- jobject jchangelists, jboolean jclear_changelists)
+ jobject jchangelists, jboolean jclear_changelists, jboolean jmetadata_only)
{
JNIEntry(SVNClient, revert);
SVNClient *cl = SVNClient::getCppObject(jthis);
@@ -459,7 +459,7 @@ Java_org_apache_subversion_javahl_SVNCli
return;
cl->revert(paths, EnumMapper::toDepth(jdepth),
- changelists, bool(jclear_changelists));
+ changelists, bool(jclear_changelists), bool(jmetadata_only));
}
JNIEXPORT void JNICALL
@@ -1646,7 +1646,8 @@ JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNClient_blame
(JNIEnv *env, jobject jthis, jstring jpath, jobject jpegRevision,
jobject jrevisionStart, jobject jrevisionEnd, jboolean jignoreMimeType,
- jboolean jincludeMergedRevisions, jobject jblameCallback)
+ jboolean jincludeMergedRevisions, jobject jblameCallback,
+ jobject jdiffOptions)
{
JNIEntry(SVNClient, blame);
SVNClient *cl = SVNClient::getCppObject(jthis);
@@ -1671,10 +1672,15 @@ Java_org_apache_subversion_javahl_SVNCli
if (JNIUtil::isExceptionThrown())
return;
+ DiffOptions options(jdiffOptions);
+ if (JNIUtil::isExceptionThrown())
+ return;
+
BlameCallback callback(jblameCallback);
cl->blame(path, pegRevision, revisionStart, revisionEnd,
jignoreMimeType ? true : false,
- jincludeMergedRevisions ? true : false, &callback);
+ jincludeMergedRevisions ? true : false, &callback,
+ options);
}
JNIEXPORT void JNICALL
Modified: subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_types_Version.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_types_Version.cpp?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_types_Version.cpp (original)
+++ subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_types_Version.cpp Mon Feb 9 11:23:39 2015
@@ -28,12 +28,19 @@
#include "JNIStackElement.h"
#include "svn_version.h"
+namespace {
+const svn_version_t* javahl_version()
+{
+ SVN_VERSION_BODY;
+}
+} //anonymous namespace
+
JNIEXPORT jint JNICALL
Java_org_apache_subversion_javahl_types_Version_getMajor(JNIEnv *env,
jobject jthis)
{
JNIEntry(Version, getMajor);
- return SVN_VER_MAJOR;
+ return javahl_version()->major;
}
JNIEXPORT jint JNICALL
@@ -41,7 +48,7 @@ Java_org_apache_subversion_javahl_types_
jobject jthis)
{
JNIEntry(Version, getMinor);
- return SVN_VER_MINOR;
+ return javahl_version()->minor;
}
JNIEXPORT jint JNICALL
@@ -49,7 +56,7 @@ Java_org_apache_subversion_javahl_types_
jobject jthis)
{
JNIEntry(Version, getPatch);
- return SVN_VER_PATCH;
+ return javahl_version()->patch;
}
JNIEXPORT jstring JNICALL
Modified: subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigLib.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigLib.cpp?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigLib.cpp (original)
+++ subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigLib.cpp Mon Feb 9 11:23:39 2015
@@ -41,8 +41,10 @@
#include "JNICriticalSection.h"
#include "svn_auth.h"
+#include "svn_base64.h"
#include "svn_config.h"
#include "svn_hash.h"
+#include "svn_x509.h"
#include "svn_private_config.h"
@@ -140,41 +142,14 @@ jobject build_credential(Java::Env env,
else if (0 == strcmp(cred_kind, SVN_AUTH_CRED_SSL_SERVER_TRUST))
{
entry = static_cast<svn_string_t*>(
- svn_hash_gets(cred, SVN_CONFIG_AUTHN_HOSTNAME_KEY));
- const char* hostname = (entry ? entry->data : NULL);
-
- entry = static_cast<svn_string_t*>(
- svn_hash_gets(cred, SVN_CONFIG_AUTHN_FINGERPRINT_KEY));
- const char* fingerprint = (entry ? entry->data : NULL);
-
- entry = static_cast<svn_string_t*>(
- svn_hash_gets(cred, SVN_CONFIG_AUTHN_VALID_FROM_KEY));
- const char* valid_from = (entry ? entry->data : NULL);
-
- entry = static_cast<svn_string_t*>(
- svn_hash_gets(cred, SVN_CONFIG_AUTHN_VALID_UNTIL_KEY));
- const char* valid_until = (entry ? entry->data : NULL);
-
- entry = static_cast<svn_string_t*>(
- svn_hash_gets(cred, SVN_CONFIG_AUTHN_ISSUER_DN_KEY));
- const char* issuer = (entry ? entry->data : NULL);
-
- entry = static_cast<svn_string_t*>(
svn_hash_gets(cred, SVN_CONFIG_AUTHN_ASCII_CERT_KEY));
- const char* der = (entry ? entry->data : NULL);
+ const char* ascii_cert = (entry ? entry->data : NULL);
entry = static_cast<svn_string_t*>(
svn_hash_gets(cred, SVN_CONFIG_AUTHN_FAILURES_KEY));
jint failflags = (!entry ? 0 : jint(apr_atoi64(entry->data)));
- info = JavaHL::AuthnCallback
- ::SSLServerCertInfo(env,
- Java::String(env, hostname),
- Java::String(env, fingerprint),
- Java::String(env, valid_from),
- Java::String(env, valid_until),
- Java::String(env, issuer),
- Java::String(env, der)).get();
+ info = JavaHL::AuthnCallback::SSLServerCertInfo(env, ascii_cert).get();
failures = JavaHL::AuthnCallback
::SSLServerCertFailures(env, failflags).get();
}
@@ -368,7 +343,20 @@ Java_org_apache_subversion_javahl_util_C
const char* const m_text_pattern;
const ::Java::Env m_env;
- ::Java::MutableList<JavaHL::Credential> m_credentials;
+ ::Java::List<JavaHL::Credential> m_credentials;
+
+ bool match_array(const char* pattern,
+ const apr_array_header_t* hostnames)
+ {
+ for (int i = 0; i < hostnames->nelts; ++i)
+ {
+ const char* const hostname =
+ APR_ARRAY_IDX(hostnames, i, const char*);
+ if (!apr_fnmatch(pattern, hostname, 0))
+ return true;
+ }
+ return false;
+ }
public:
explicit Callback(::Java::Env ctor_env,
@@ -411,25 +399,41 @@ Java_org_apache_subversion_javahl_util_C
svn_hash_gets(cb_cred_hash, SVN_CONFIG_AUTHN_PASSTYPE_KEY));
const char* const store = (entry ? entry->data : NULL);
- entry = static_cast<svn_string_t*>(
- svn_hash_gets(cb_cred_hash, SVN_CONFIG_AUTHN_HOSTNAME_KEY));
- const char* const hostname = (entry ? entry->data : NULL);
-
- entry = static_cast<svn_string_t*>(
- svn_hash_gets(cb_cred_hash, SVN_CONFIG_AUTHN_FINGERPRINT_KEY));
- const char* const fingerprint = (entry ? entry->data : NULL);
+ const svn_string_t* ascii_cert = static_cast<svn_string_t*>(
+ svn_hash_gets(cb_cred_hash, SVN_CONFIG_AUTHN_ASCII_CERT_KEY));
- entry = static_cast<svn_string_t*>(
- svn_hash_gets(cb_cred_hash, SVN_CONFIG_AUTHN_VALID_FROM_KEY));
- const char* const valid_from = (entry ? entry->data : NULL);
-
- entry = static_cast<svn_string_t*>(
- svn_hash_gets(cb_cred_hash, SVN_CONFIG_AUTHN_VALID_UNTIL_KEY));
- const char* const valid_until = (entry ? entry->data : NULL);
-
- entry = static_cast<svn_string_t*>(
- svn_hash_gets(cb_cred_hash, SVN_CONFIG_AUTHN_ISSUER_DN_KEY));
- const char* const issuer = (entry ? entry->data : NULL);
+ /* Parsed certificate data. */
+ const char* subject = NULL;
+ const char* issuer = NULL;
+ const char* fingerprint = NULL;
+ const apr_array_header_t* hostnames = NULL;
+
+ if (ascii_cert)
+ {
+ const svn_string_t* const der =
+ svn_base64_decode_string(ascii_cert, cb_scratch_pool);
+ svn_x509_certinfo_t* certinfo;
+ svn_error_t* err = svn_x509_parse_cert(
+ &certinfo, der->data, der->len,
+ cb_scratch_pool, cb_scratch_pool);
+ if (err)
+ {
+ // Ignore credentials that can't be parsed.
+ svn_error_clear(err);
+ return SVN_NO_ERROR;
+ }
+ else
+ {
+ subject = svn_x509_certinfo_get_subject(
+ certinfo, cb_scratch_pool);
+ issuer = svn_x509_certinfo_get_issuer(
+ certinfo, cb_scratch_pool);
+ fingerprint = svn_checksum_to_cstring_display(
+ svn_x509_certinfo_get_digest(certinfo),
+ cb_scratch_pool);
+ hostnames = svn_x509_certinfo_get_hostnames(certinfo);
+ }
+ }
bool match = (m_realm_pattern
&& !apr_fnmatch(m_realm_pattern, cb_realmstring, 0));
@@ -441,8 +445,8 @@ Java_org_apache_subversion_javahl_util_C
if (!match && m_hostname_pattern)
match = (match
- || (hostname
- && !apr_fnmatch(m_hostname_pattern, hostname, 0)));
+ || (hostnames
+ && match_array(m_hostname_pattern, hostnames)));
if (!match && m_text_pattern)
match = (match
@@ -450,16 +454,14 @@ Java_org_apache_subversion_javahl_util_C
&& !apr_fnmatch(m_text_pattern, username, 0))
|| (store
&& !apr_fnmatch(m_text_pattern, store, 0))
- || (hostname
- && !apr_fnmatch(m_text_pattern, hostname, 0))
+ || (subject
+ && !apr_fnmatch(m_text_pattern, subject, 0))
+ || (issuer
+ && !apr_fnmatch(m_text_pattern, issuer, 0))
|| (fingerprint
&& !apr_fnmatch(m_text_pattern, fingerprint, 0))
- || (valid_from
- && !apr_fnmatch(m_text_pattern, valid_from, 0))
- || (valid_until
- && !apr_fnmatch(m_text_pattern, valid_until, 0))
- || (issuer
- && !apr_fnmatch(m_text_pattern, issuer, 0)));
+ || (hostnames
+ && match_array(m_text_pattern, hostnames)));
if (match)
m_credentials.add(
Modified: subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_PropLib.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_PropLib.cpp?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_PropLib.cpp (original)
+++ subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_PropLib.cpp Mon Feb 9 11:23:39 2015
@@ -291,7 +291,7 @@ Java_org_apache_subversion_javahl_util_P
pool.getPool()));
}
- Java::MutableList<JavaHL::ExternalItem> items(env, externals->nelts);
+ Java::List<JavaHL::ExternalItem> items(env, externals->nelts);
for (jint i = 0; i < externals->nelts; ++i)
{
// References to the newly created external items are stored
@@ -323,7 +323,7 @@ Java_org_apache_subversion_javahl_util_P
{
const Java::Env env(jenv);
- const Java::List<JavaHL::ExternalItem> items(env, jitems);
+ const Java::ImmutableList<JavaHL::ExternalItem> items(env, jitems);
const Java::String parent_dir(env, jparent_dir);
// Using a "global" iteration pool since we don't keep a context
Modified: subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_SubstLib.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_SubstLib.cpp?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_SubstLib.cpp (original)
+++ subversion/branches/remove-log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_SubstLib.cpp Mon Feb 9 11:23:39 2015
@@ -118,6 +118,8 @@ Java_org_apache_subversion_javahl_util_S
jstring jurl, jstring jrepos_root_url,
jobject jdate, jstring jauthor)
{
+ typedef Java::Map<Java::ByteArray, jbyteArray> ByteArrayMap;
+
SVN_JAVAHL_JNI_TRY(SubstLib, buildKeywords)
{
const Java::Env env(jenv);
@@ -130,8 +132,7 @@ Java_org_apache_subversion_javahl_util_S
env, pool, jkeywords_value, jrevision,
jurl, jrepos_root_url, jdate, jauthor);
- Java::MutableMap<Java::ByteArray, jbyteArray>
- keywords(env, jint(apr_hash_count(kw)));
+ ByteArrayMap keywords(env, jint(apr_hash_count(kw)));
for (apr_hash_index_t* hi = apr_hash_first(pool.getPool(), kw);
hi; hi = apr_hash_next(hi))
{
Modified: subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ConflictDescriptor.java
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ConflictDescriptor.java?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ConflictDescriptor.java (original)
+++ subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ConflictDescriptor.java Mon Feb 9 11:23:39 2015
@@ -71,13 +71,26 @@ public class ConflictDescriptor
*/
private ConflictVersion srcRightVersion;
- /** This constructor should only be called from JNI code. */
- public ConflictDescriptor(String path, Kind conflictKind, NodeKind nodeKind,
+ // Information about property conflicts. New in 1.9
+ private String propRejectAbspath;
+ private byte[] propValueBase;
+ private byte[] propValueWorking;
+ private byte[] propValueIncomingOld;
+ private byte[] propValueIncomingNew;
+
+
+ // Private constructor, only called from the JNI code.
+ private ConflictDescriptor(String path, Kind conflictKind, NodeKind nodeKind,
String propertyName, boolean isBinary, String mimeType,
Action action, Reason reason, Operation operation,
String basePath, String theirPath,
String myPath, String mergedPath,
- ConflictVersion srcLeft, ConflictVersion srcRight)
+ ConflictVersion srcLeft, ConflictVersion srcRight,
+ String propRejectAbspath, byte[] propValueBase,
+ byte[] propValueWorking,
+ byte[] propValueIncomingOld,
+ byte[] propValueIncomingNew)
+
{
this.path = path;
this.conflictKind = conflictKind;
@@ -94,6 +107,28 @@ public class ConflictDescriptor
this.operation = operation;
this.srcLeftVersion = srcLeft;
this.srcRightVersion = srcRight;
+ this.propRejectAbspath = propRejectAbspath;
+ this.propValueBase = propValueBase;
+ this.propValueWorking = propValueWorking;
+ this.propValueIncomingOld = propValueIncomingOld;
+ this.propValueIncomingNew = propValueIncomingNew;
+ }
+
+ /**
+ * This constructor should only be called from JNI code.
+ * @deprecated
+ */
+ @Deprecated
+ public ConflictDescriptor(String path, Kind conflictKind, NodeKind nodeKind,
+ String propertyName, boolean isBinary, String mimeType,
+ Action action, Reason reason, Operation operation,
+ String basePath, String theirPath,
+ String myPath, String mergedPath,
+ ConflictVersion srcLeft, ConflictVersion srcRight)
+ {
+ this(path, conflictKind, nodeKind, propertyName, isBinary, mimeType,
+ action, reason, operation, basePath, theirPath, myPath, mergedPath,
+ srcLeft, srcRight, null, null, null, null, null);
}
public String getPath()
@@ -171,6 +206,32 @@ public class ConflictDescriptor
return srcRightVersion;
}
+ public String getPropRejectAbspath()
+ {
+ return propRejectAbspath;
+ }
+
+ public byte[] getPropValueBase()
+ {
+ return propValueBase;
+ }
+
+ public byte[] getPropValueWorking()
+ {
+ return propValueWorking;
+ }
+
+ public byte[] getPropValueIncomingOld()
+ {
+ return propValueIncomingOld;
+ }
+
+ public byte[] getPropValueIncomingNew()
+ {
+ return propValueIncomingNew;
+ }
+
+
/**
* Rich man's enum for <code>svn_wc_conflict_kind_t</code>.
*/
Modified: subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java (original)
+++ subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java Mon Feb 9 11:23:39 2015
@@ -261,12 +261,15 @@ public interface ISVNClient
* @param changelists changelists to filter by
* @param clearChangelists If set, will clear changelist association
* from the reverted paths.
+ * @param metadataOnly Revert just the metadata (including conflict data)
+ * and not the working files/dirs
* @throws ClientException
* @since 1.9
*/
void revert(Set<String> paths, Depth depth,
Collection<String> changelists,
- boolean clearChangelists)
+ boolean clearChangelists,
+ boolean metadataOnly)
throws ClientException;
/**
@@ -1323,12 +1326,28 @@ public interface ISVNClient
* information
* @param callback callback to receive the file content and the other
* information
+ * @param options additional options for controlling the output
* @throws ClientException
+ * @since 1.9
*/
void blame(String path, Revision pegRevision, Revision revisionStart,
Revision revisionEnd, boolean ignoreMimeType,
boolean includeMergedRevisions,
- BlameCallback callback) throws ClientException;
+ BlameCallback callback, DiffOptions options)
+ throws ClientException;
+
+ /**
+ * Retrieve the content together with the author, the revision and the date
+ * of the last change of each line
+ * <p>
+ * Behaves like the 1.9 version with <code>options</code> set to
+ * their default values.
+ */
+ void blame(String path, Revision pegRevision, Revision revisionStart,
+ Revision revisionEnd, boolean ignoreMimeType,
+ boolean includeMergedRevisions,
+ BlameCallback callback)
+ throws ClientException;
/**
* Set directory for the configuration information, taking the
Modified: subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java (original)
+++ subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java Mon Feb 9 11:23:39 2015
@@ -599,13 +599,15 @@ public interface ISVNRemote
private FileRevision(String path, long revision,
boolean resultOfMerge,
Map<String, byte[]> revisionProperties,
- Map<String, byte[]> propertiesDelta)
+ Map<String, byte[]> propertiesDelta,
+ boolean textDelta)
{
this.path = path;
this.revision = revision;
this.resultOfMerge = resultOfMerge;
this.revisionProperties = revisionProperties;
this.propertiesDelta = propertiesDelta;
+ this.textDelta = textDelta;
}
/**
@@ -643,11 +645,17 @@ public interface ISVNRemote
return propertiesDelta;
}
+ /**
+ * @return A flag indicating that this revision has a text delta.
+ */
+ public boolean hasTextDelta() { return textDelta; }
+
private String path;
private long revision;
private boolean resultOfMerge;
private Map<String, byte[]> revisionProperties;
private Map<String, byte[]> propertiesDelta;
+ private boolean textDelta;
}
/**
Modified: subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java (original)
+++ subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java Mon Feb 9 11:23:39 2015
@@ -194,21 +194,22 @@ public class SVNClient implements ISVNCl
public native void revert(Set<String> paths, Depth depth,
Collection<String> changelists,
- boolean clearChangelists)
+ boolean clearChangelists,
+ boolean metadataOnly)
throws ClientException;
public void revert(Set<String> paths, Depth depth,
Collection<String> changelists)
throws ClientException
{
- revert(paths, depth, changelists, false);
+ revert(paths, depth, changelists, false, false);
}
public void revert(String path, Depth depth,
Collection<String> changelists)
throws ClientException
{
- revert(Collections.singleton(path), depth, changelists, false);
+ revert(Collections.singleton(path), depth, changelists, false, false);
}
public native void add(String path, Depth depth, boolean force,
@@ -651,11 +652,23 @@ public class SVNClient implements ISVNCl
boolean ignoreExternals)
throws ClientException;
+ public void blame(String path, Revision pegRevision,
+ Revision revisionStart,
+ Revision revisionEnd, boolean ignoreMimeType,
+ boolean includeMergedRevisions,
+ BlameCallback callback)
+ throws ClientException
+ {
+ blame(path, pegRevision, revisionStart, revisionEnd, ignoreMimeType,
+ includeMergedRevisions, callback, null);
+ }
+
public native void blame(String path, Revision pegRevision,
Revision revisionStart,
Revision revisionEnd, boolean ignoreMimeType,
boolean includeMergedRevisions,
- BlameCallback callback)
+ BlameCallback callback,
+ DiffOptions options)
throws ClientException;
public native void setConfigDirectory(String configDir)
Modified: subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNUtil.java
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNUtil.java?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNUtil.java (original)
+++ subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNUtil.java Mon Feb 9 11:23:39 2015
@@ -466,11 +466,12 @@ public class SVNUtil
* otherwise, only those credentials that have a username,
* and where the username matches the pattern, will be
* returned.
- * @param hostnamePattern A glob pattern for the hostname (CN) of
- * a server certificate; if <code>null</code>, all credntials
- * will be considered; otherwise, only those credentials
- * that have a server certificate with a hostname that
- * matches the pattern will be returned.
+ * @param hostnamePattern A glob pattern for the hostnames of a
+ * server certificate; if <code>null</code>, all
+ * credntials will be considered; otherwise, only
+ * those credentials that have a server certificate
+ * with a hostname that matches the pattern will be
+ * returned.
* @param textPattern A glob pattern that must match any textual
* information in a credential, for example, a realm,
* username, certificate details, etc; passwords, passphrases
Modified: subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/AuthnCallback.java
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/AuthnCallback.java?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/AuthnCallback.java (original)
+++ subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/AuthnCallback.java Mon Feb 9 11:23:39 2015
@@ -23,6 +23,8 @@
package org.apache.subversion.javahl.callback;
+import java.util.Date;
+import java.util.List;
import java.util.logging.Logger;
/**
@@ -243,74 +245,84 @@ public interface AuthnCallback
private static final long serialVersionUID = 1L;
/**
- * @return The primary CN of the certificate.
+ * @return The subject of the certificate.
*/
- public String getHostname()
+ public String getSubject()
{
- return hostname;
+ return subject;
}
/**
- * @return The text representation of the certificate fingerprint.
+ * @return The certificate issuer.
*/
- public String getFingerprint()
+ public String getIssuer()
{
- return fingerprint;
+ return issuer;
}
/**
- * @return The text represent representation of the date from
- * which the certificate is valid.
+ * @return The from which the certificate is valid.
*/
- public String getValidFrom()
+ public Date getValidFrom()
{
return validFrom;
}
/**
- * @return The text represent representation of the date after
- * which the certificate is no longer valid.
+ * @return The date after which the certificate is no longer valid.
*/
- public String getValidUntil()
+ public Date getValidTo()
{
- return validUntil;
+ return validTo;
}
/**
- * @return The DN of the certificate issuer.
+ * @return The certificate fingerprint.
*/
- public String getIssuer()
+ public byte[] getFingerprint()
{
- return issuer;
+ return fingerprint;
}
/**
- * @return the Base64-encoded DER representation of the certificate.
+ * @return A list of host names that the certificate represents.
*/
- public String getDER()
+ public List<String> getHostnames()
{
- return der;
+ return hostnames;
+ }
+
+ /**
+ * @return the Base64-encoded raw certificate data.
+ */
+ public String getCert()
+ {
+ return asciiCert;
}
/* This private constructor is used by the native implementation. */
- private SSLServerCertInfo(String hostname, String fingerprint,
- String validFrom, String validUntil,
- String issuer, String der)
+ private SSLServerCertInfo(String subject, String issuer,
+ long validFrom, long validTo,
+ byte[] fingerprint,
+ List<String> hostnames,
+ String asciiCert)
{
- this.hostname = hostname;
- this.fingerprint = fingerprint;
- this.validFrom = validFrom;
- this.validUntil = validUntil;
+ this.subject = subject;
this.issuer = issuer;
- this.der = der;
+ this.validFrom = new Date(validFrom);
+ this.validTo = new Date(validTo);
+ this.fingerprint = fingerprint;
+ this.hostnames = hostnames;
+ this.asciiCert = asciiCert;
}
- private String hostname;
- private String fingerprint;
- private String validFrom;
- private String validUntil;
+ private String subject;
private String issuer;
- private String der;
+ private Date validFrom;
+ private Date validTo;
+ private byte[] fingerprint;
+ private List<String> hostnames;
+ private String asciiCert;
}
/**
Modified: subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/ConfigLib.java
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/ConfigLib.java?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/ConfigLib.java (original)
+++ subversion/branches/remove-log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/ConfigLib.java Mon Feb 9 11:23:39 2015
@@ -81,48 +81,6 @@ public class ConfigLib
return nativeRemoveCredential(configDir, kind.toString(), realm);
}
- ///** @see SVNUtil.addCredential */
- //public SVNUtil.Credential addCredential(String configDir,
- // SVNUtil.Credential credential,
- // boolean replace)
- // throws ClientException, SubversionException
- //{
- // final SVNUtil.Credential.Kind kind = credential.getKind();
- //
- // final String username =
- // ((kind == SVNUtil.Credential.Kind.username
- // || kind == SVNUtil.Credential.Kind.simple)
- // ? credential.getUsername() : null);
- //
- // final String password =
- // (kind == SVNUtil.Credential.Kind.simple
- // ? credential.getPassword() : null);
- //
- // final AuthnCallback.SSLServerCertInfo sci =
- // (kind == SVNUtil.Credential.Kind.sslServer
- // ? credential.getServerCertInfo() : null);
- //
- // final AuthnCallback.SSLServerCertFailures scf =
- // (kind == SVNUtil.Credential.Kind.sslServer
- // ? credential.getServerCertFailures() : null);
- //
- // final String passphrase =
- // (kind == SVNUtil.Credential.Kind.sslClientPassphrase
- // ? credential.getClientCertPassphrase() : null);
- //
- // return nativeAddCredential(configDir, kind.toString(),
- // credential.getRealm(),
- // username, password,
- // (sci != null ? sci.getHostname() : null),
- // (sci != null ? sci.getFingerprint() : null),
- // (sci != null ? sci.getValidFrom() : null),
- // (sci != null ? sci.getValidUntil() : null),
- // (sci != null ? sci.getIssuer() : null),
- // (sci != null ? sci.getDER() : null),
- // (scf != null ? scf.getFailures() : 0),
- // passphrase);
- //}
-
/** @see SVNUtil.searchCredentials */
public List<SVNUtil.Credential>
searchCredentials(String configDir,
@@ -151,22 +109,6 @@ public class ConfigLib
String realm)
throws ClientException, SubversionException;
- //private native SVNUtil.Credential
- // nativeAddCredential(String configDir,
- // String kind,
- // String realm,
- // String username,
- // String password,
- // String serverCertHostname,
- // String serverCertFingerprint,
- // String serverCertValidFrom,
- // String serverCertValidUntil,
- // String serverCertIssuer,
- // String serverCertDER,
- // int serverCertFailures,
- // String clientCertPassphrase)
- // throws ClientException, SubversionException;
-
private native List<SVNUtil.Credential>
nativeSearchCredentials(String configDir,
String kind,
Modified: subversion/branches/remove-log-addressing/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java (original)
+++ subversion/branches/remove-log-addressing/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java Mon Feb 9 11:23:39 2015
@@ -259,7 +259,7 @@ public class BasicTests extends SVNTests
tempclient.dispose();
// create Y and Y/Z directories in the repository
- addExpectedCommitItem(null, thisTest.getUrl().toString(), "Y", NodeKind.none,
+ addExpectedCommitItem(null, thisTest.getUrl().toString(), "Y", NodeKind.dir,
CommitItemStateFlags.Add);
Set<String> urls = new HashSet<String>(1);
urls.add(thisTest.getUrl() + "/Y");
@@ -1004,9 +1004,9 @@ public class BasicTests extends SVNTests
OneTest thisTest = new OneTest();
// create Y and Y/Z directories in the repository
- addExpectedCommitItem(null, thisTest.getUrl().toString(), "Y", NodeKind.none,
+ addExpectedCommitItem(null, thisTest.getUrl().toString(), "Y", NodeKind.dir,
CommitItemStateFlags.Add);
- addExpectedCommitItem(null, thisTest.getUrl().toString(), "Y/Z", NodeKind.none,
+ addExpectedCommitItem(null, thisTest.getUrl().toString(), "Y/Z", NodeKind.dir,
CommitItemStateFlags.Add);
Set<String> urls = new HashSet<String>(2);
urls.add(thisTest.getUrl() + "/Y");
@@ -3885,11 +3885,46 @@ public class BasicTests extends SVNTests
false, false, callback);
assertEquals(1, callback.numberOfLines());
BlameCallbackImpl.BlameLine line = callback.getBlameLine(0);
- if (line != null)
- {
- assertEquals(1, line.getRevision());
- assertEquals("jrandom", line.getAuthor());
+ assertNotNull(line);
+ assertEquals(1, line.getRevision());
+ assertEquals("jrandom", line.getAuthor());
+ assertEquals("This is the file 'iota'.", line.getLine());
+ }
+
+ /**
+ * Test blame with diff options.
+ * @since 1.9
+ */
+ public void testBlameWithDiffOptions() throws Throwable
+ {
+ OneTest thisTest = new OneTest();
+ // Modify the file iota, making only whitespace changes.
+ File iota = new File(thisTest.getWorkingCopy(), "iota");
+ FileOutputStream stream = new FileOutputStream(iota, false);
+ stream.write("This is the file 'iota'.\t".getBytes());
+ stream.close();
+ Set<String> srcPaths = new HashSet<String>(1);
+ srcPaths.add(thisTest.getWCPath());
+ try {
+ client.username("rayjandom");
+ client.commit(srcPaths, Depth.infinity, false, false, null, null,
+ new ConstMsg("Whitespace-only change in /iota"), null);
+ } finally {
+ client.username("jrandom");
}
+
+ // Run blame on the result
+ BlameCallbackImpl callback = new BlameCallbackImpl();
+ client.blame(thisTest.getWCPath() + "/iota", Revision.HEAD,
+ Revision.getInstance(1), Revision.HEAD,
+ false, false, callback,
+ new DiffOptions(DiffOptions.Flag.IgnoreWhitespace));
+ assertEquals(1, callback.numberOfLines());
+ BlameCallbackImpl.BlameLine line = callback.getBlameLine(0);
+ assertNotNull(line);
+ assertEquals(1, line.getRevision());
+ assertEquals("jrandom", line.getAuthor());
+ assertEquals("This is the file 'iota'.\t", line.getLine());
}
/**
Modified: subversion/branches/remove-log-addressing/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java (original)
+++ subversion/branches/remove-log-addressing/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java Mon Feb 9 11:23:39 2015
@@ -1398,6 +1398,7 @@ public class SVNRemoteTests extends SVNT
ISVNRemote.FileRevision rev = result.get(0);
assertEquals("/iota", rev.getPath());
assertFalse(rev.isResultOfMerge());
+ assertTrue(rev.hasTextDelta());
}
// This test is a result of a threading bug that was identified in
Modified: subversion/branches/remove-log-addressing/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java (original)
+++ subversion/branches/remove-log-addressing/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java Mon Feb 9 11:23:39 2015
@@ -257,10 +257,11 @@ class SVNTests extends TestCase
greekRepos = new File(localTmp, "repos");
greekDump = new File(localTmp, "greek_dump");
admin.create(greekRepos, true,false, null, this.fsType);
- addExpectedCommitItem(greekFiles.getAbsolutePath(), null, null,
- NodeKind.none, CommitItemStateFlags.Add);
+ addExpectedCommitItem(greekFiles.getAbsolutePath(),
+ makeReposUrl(greekRepos).toString(), null,
+ NodeKind.dir, CommitItemStateFlags.Add);
client.doImport(greekFiles.getAbsolutePath(),
- makeReposUrl(greekRepos).toString(),
+ makeReposUrl(greekRepos).toString(),
Depth.infinity, false, false, null,
new MyCommitMessage(), null);
admin.dump(greekRepos, new FileOutputStream(greekDump),