Re: svn commit: r1053915 - in /subversion/trunk/subversion/bindings/javahl: native/ src/org/apache/subversion/javahl/

2010-12-30 Thread Blair Zajac

On 12/30/10 11:25 AM, Hyrum Wright wrote:

On Thu, Dec 30, 2010 at 2:18 PM, Blair Zajac  wrote:

On 12/30/10 7:24 AM, hwri...@apache.org wrote:


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)


According to the Java docs:

"""Encodes this String into a sequence of bytes using the platform's default
charset, storing the result into a new byte array."""  The platform's
default may not be UTF-8.


Thanks for the review, but both of these instances have been removed
in subsequent commits.


Thanks, I see that.

Blair


Re: svn commit: r1053915 - in /subversion/trunk/subversion/bindings/javahl: native/ src/org/apache/subversion/javahl/

2010-12-30 Thread Hyrum Wright
On Thu, Dec 30, 2010 at 2:18 PM, Blair Zajac  wrote:
> On 12/30/10 7:24 AM, hwri...@apache.org wrote:
>>
>> 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(),
>
> Should this be value.getBytes("UTF-8")?
>
>> +    public void propertySet(String path, String name, String value,
>> +                            Depth depth, Collection  changelists,
>> +                            boolean force,
>> +                            Map  revpropTable,
>> +                            CommitCallback callback)
>> +            throws ClientException
>> +    {
>> +        propertySet(path, name, value != null ? value.getBytes() : null,
>> +                    depth, changelists, force, revpropTable, callback);
>
> And here?
>
> According to the Java docs:
>
> """Encodes this String into a sequence of bytes using the platform's default
> charset, storing the result into a new byte array."""  The platform's
> default may not be UTF-8.

Thanks for the review, but both of these instances have been removed
in subsequent commits.

-Hyrum


Re: svn commit: r1053915 - in /subversion/trunk/subversion/bindings/javahl: native/ src/org/apache/subversion/javahl/

2010-12-30 Thread Blair Zajac

On 12/30/10 7:24 AM, hwri...@apache.org wrote:

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(),


Should this be value.getBytes("UTF-8")?


+public void propertySet(String path, String name, String value,
+Depth depth, Collection  changelists,
+boolean force,
+Map  revpropTable,
+CommitCallback callback)
+throws ClientException
+{
+propertySet(path, name, value != null ? value.getBytes() : null,
+depth, changelists, force, revpropTable, callback);


And here?

According to the Java docs:

"""Encodes this String into a sequence of bytes using the platform's default 
charset, storing the result into a new byte array."""  The platform's default 
may not be UTF-8.


Blair