On Thu, Dec 30, 2010 at 2:18 PM, Blair Zajac <blair_at_orcaware.com> wrote:
> On 12/30/10 7:24 AM, hwright_at_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<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);
>
> 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
Received on 2010-12-30 20:26:33 CET