[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

JavaHL SVNClient.logMessages() cannot return all revision properties.

From: Doros Agathangelou <doros_at_triadiktyo.com>
Date: Mon, 7 Nov 2016 12:56:38 +0200

Hi All

I have been trying to get the logMessages of a repository along with ALL
revision properties. Turns out this is not possible through javahl and I
believe this creates an inconsistency between javahl and the svn C api.

This is because in the C API, *svn_client_log5* will accept a NULL argument
for the revprops argument to return all revision properties. Excerpt from
API follows

 * If @a revprops is NULL, retrieve all revision properties; else, retrieve
 * only the revision properties named by the (const char *) array elements
 * (i.e. retrieve none if the array is empty).

Now I believe the problem in javahl is that the class StringArray does not
cater for NULL values and will turn a NULL value into an empty string
array.

This can be seen in file org_apache_subversion_javahl_SVNClient.cpp at
method Java_org_apache_subversion_javahl_SVNClient_logMessages,

If a null is passed to jrevProps then the line:
StringArray revProps(jrevProps);
will initialize a revProps object with an empty collection.

This array generated from the revProps object will subsequently be passed
to svn_client_log5 as an empty array (instead of a NULL) which means that
no revision properties are returned when the intention was to actually
receive all revisions.

I have fixed this in my builds using the attached patch. It is probably not
the best or cleanest solution but it works. I am hoping that a more
experienced person might provide a better solution to this. Or if this is
an acceptable fix maybe commit this patch to the trunk.

Some notes on the attached patch: The reason I am creating a new
StringArray constructor is because StringArray is used in a lot of places
and I am not sure if allowing NULLs everywhere might cause more trouble in
the rest of the API. This new constructor will set a flag of whether the
revProps were NULL and then in the array() method we check the flag to
return NULL instead of an empty array.

Thanks
Doros

Received on 2016-11-07 11:56:54 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.