Daniel Rall wrote:
> On Thu, 26 Apr 2007, hwright@tigris.org wrote:
> ...
>> JavaHL: Eliminate duplicate native implementations of propertyCreate(), and
>> implement one version as a wrapper around the other. Also, modify the
>> properties test to use propertyCreate() as well as propertySet().
> ...
>> --- trunk/subversion/bindings/javahl/native/org_tigris_subversion_javahl_SVNClient.cpp (original)
>> +++ trunk/subversion/bindings/javahl/native/org_tigris_subversion_javahl_SVNClient.cpp Thu Apr 26 09:00:39 2007
> ...
>> -JNIEXPORT void JNICALL
>> -Java_org_tigris_subversion_javahl_SVNClient_propertyCreate__Ljava_lang_String_2Ljava_lang_String_2_3BZZ
>> -(JNIEnv *env, jobject jthis, jstring jpath, jstring jname, jbyteArray jvalue,
>> - jboolean jrecurse, jboolean jforce)
>> -{
>> - JNIEntry(SVNClient, propertyCreate);
>> - SVNClient *cl = SVNClient::getCppObject(jthis);
>> - if (cl == NULL)
>> - {
>> - JNIUtil::throwError(_("bad C++ this"));
>> - return;
>> - }
>> - JNIStringHolder path(jpath);
>> - if (JNIUtil::isExceptionThrown())
>> - return;
>> -
>> - JNIStringHolder name(jname);
>> - if (JNIUtil::isExceptionThrown())
>> - return;
>> -
>> - JNIByteArray value(jvalue);
>> - if (JNIUtil::isExceptionThrown())
>> - return;
>> -
>> - cl->propertyCreate(path, name, (const char *)value.getBytes(),
>> - jrecurse ? true:false,
>> - jforce ? true:false);
>> -}
>> -
>> JNIEXPORT jobject JNICALL
>> Java_org_tigris_subversion_javahl_SVNClient_revProperty
>> (JNIEnv *env, jobject jthis, jstring jpath, jstring jname, jobject jrevision)
>>
>> Modified: trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java
>> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java?pathrev=24791&r1=24790&r2=24791
>> ==============================================================================
>> --- trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java (original)
>> +++ trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java Thu Apr 26 09:00:39 2007
>> @@ -1447,9 +1447,12 @@
>> * @throws ClientException
>> * @since 1.2
>> */
>> - public native void propertyCreate(String path, String name, byte[] value,
>> - boolean recurse, boolean force)
>> - throws ClientException;
>> + public void propertyCreate(String path, String name, byte[] value,
>> + boolean recurse, boolean force)
>> + throws ClientException
>> + {
>> + propertyCreate(path, name, new String(value), recurse, force);
>> + }
> ...
>
> Isn't "new String(value)" doing an implicit byte -> char conversion in
> the JVM's default character set? Could this be lossy?
>
> It might be safer to make this change the other way around...
Sure. The motivation for doing it this way was consistency with a
similar construct in propertySet(). I'd be happy to change them both if
needed.
-Hyrum
Received on Thu Apr 26 19:33:28 2007