Author: hwright
Date: Thu Dec 30 15:24:02 2010
New Revision: 1053915
URL: http://svn.apache.org/viewvc?rev=1053915&view=rev
Log:
Address issue #3670 by providing a byte-array interface for property
setting and creation in JavaHL. This does not include a test (I'm hoping
the bug reporter can provide one).
This introduces overloaded versions of the propertySet() and propertyCreate()
APIs. I'm tempted to remove the originals, but didn't want to update the
tests in this commit.
[ in subversion/bindings/javahl/ ]
* native/SVNClient.h,
native/SVNClient.cpp
(propertySet): Use a byte array in place of a string to constuct the C-API
inputs.
* native/org_apache_subversion_javahl_SVNClient.cpp
(Java_org_apache_subversion_javahl_SVNClient_propertySet): Take a byte array
as input.
* src/org/apache/subversion/javahl/SVNClient.java
(propertySet, propertyCreate): Introduce versions of these APIs which take
byte[] values.
* src/org/apache/subversion/javahl/ISVNClient.java:
(propertySet, propertyCreate): Same.
Modified:
subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp
subversion/trunk/subversion/bindings/javahl/native/SVNClient.h
subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
Modified: subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp?rev=1053915&r1=1053914&r2=1053915&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp Thu Dec 30
15:24:02 2010
@@ -870,7 +870,7 @@ void SVNClient::properties(const char *p
}
void SVNClient::propertySet(const char *path, const char *name,
- const char *value, svn_depth_t depth,
+ JNIByteArray &value, svn_depth_t depth,
StringArray &changelists, bool force,
RevpropTable &revprops, CommitCallback *callback)
{
@@ -879,10 +879,11 @@ void SVNClient::propertySet(const char *
SVN_JNI_NULL_PTR_EX(name, "name", );
svn_string_t *val;
- if (value == NULL)
+ if (value.isNull())
val = NULL;
else
- val = svn_string_create(value, requestPool.pool());
+ val = svn_string_ncreate((const char *)value.getBytes(),
value.getLength(),
+ requestPool.pool());
Path intPath(path);
SVN_JNI_ERR(intPath.error_occured(), );
Modified: subversion/trunk/subversion/bindings/javahl/native/SVNClient.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/SVNClient.h?rev=1053915&r1=1053914&r2=1053915&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/SVNClient.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/SVNClient.h Thu Dec 30
15:24:02 2010
@@ -78,7 +78,7 @@ class SVNClient :public SVNBase
bool ignoreExternals);
void streamFileContent(const char *path, Revision &revision,
Revision &pegRevision, OutputStream &outputStream);
- void propertySet(const char *path, const char *name, const char *value,
+ void propertySet(const char *path, const char *name, JNIByteArray &value,
svn_depth_t depth, StringArray &changelists, bool force,
RevpropTable &revprops, CommitCallback *callback);
void properties(const char *path, Revision &revision,
Modified:
subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp?rev=1053915&r1=1053914&r2=1053915&view=diff
==============================================================================
---
subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
(original)
+++
subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
Thu Dec 30 15:24:02 2010
@@ -914,7 +914,7 @@ Java_org_apache_subversion_javahl_SVNCli
JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNClient_propertySet
-(JNIEnv *env, jobject jthis, jstring jpath, jstring jname, jstring jvalue,
+(JNIEnv *env, jobject jthis, jstring jpath, jstring jname, jbyteArray jvalue,
jobject jdepth, jobject jchangelists, jboolean jforce, jobject jrevpropTable,
jobject jcallback)
{
@@ -933,7 +933,7 @@ Java_org_apache_subversion_javahl_SVNCli
if (JNIUtil::isExceptionThrown())
return;
- JNIStringHolder value(jvalue);
+ JNIByteArray value(jvalue);
if (JNIUtil::isExceptionThrown())
return;
Modified:
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java?rev=1053915&r1=1053914&r2=1053915&view=diff
==============================================================================
---
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
(original)
+++
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
Thu Dec 30 15:24:02 2010
@@ -674,6 +674,11 @@ public interface ISVNClient
* @throws ClientException
* @since 1.5
*/
+ void propertySet(String path, String name, byte[] value, Depth depth,
+ Collection<String> changelists, boolean force,
+ Map<String, String> revpropTable, CommitCallback callback)
+ throws ClientException;
+
void propertySet(String path, String name, String value, Depth depth,
Collection<String> changelists, boolean force,
Map<String, String> revpropTable, CommitCallback callback)
@@ -704,6 +709,11 @@ public interface ISVNClient
* @throws ClientException
* @since 1.5
*/
+ void propertyCreate(String path, String name, byte[] value, Depth depth,
+ Collection<String> changelists, boolean force,
+ CommitCallback callback)
+ throws ClientException;
+
void propertyCreate(String path, String name, String value, Depth depth,
Collection<String> changelists, boolean force,
CommitCallback callback)
Modified:
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java?rev=1053915&r1=1053914&r2=1053915&view=diff
==============================================================================
---
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
(original)
+++
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
Thu Dec 30 15:24:02 2010
@@ -414,13 +414,24 @@ public class SVNClient implements ISVNCl
/**
* @since 1.5
*/
- public native void propertySet(String path, String name, String value,
+ public native void propertySet(String path, String name, byte[] value,
Depth depth, Collection<String> changelists,
boolean force,
Map<String, String> revpropTable,
CommitCallback callback)
throws ClientException;
+ public void propertySet(String path, String name, String value,
+ Depth depth, Collection<String> changelists,
+ boolean force,
+ Map<String, String> revpropTable,
+ CommitCallback callback)
+ throws ClientException
+ {
+ propertySet(path, name, value != null ? value.getBytes() : null,
+ depth, changelists, force, revpropTable, callback);
+ }
+
/**
* @since 1.5
*/
@@ -429,13 +440,22 @@ public class SVNClient implements ISVNCl
CommitCallback callback)
throws ClientException
{
- propertySet(path, name, null, depth, changelists, false, null,
+ propertySet(path, name, (byte []) null, depth, changelists, false,
null,
callback);
}
/**
* @since 1.5
*/
+ public void propertyCreate(String path, String name, byte[] value,
+ Depth depth, Collection<String> changelists,
+ boolean force, CommitCallback callback)
+ throws ClientException
+ {
+ propertySet(path, name, value, depth, changelists, force, null,
+ callback);
+ }
+
public void propertyCreate(String path, String name, String value,
Depth depth, Collection<String> changelists,
boolean force, CommitCallback callback)