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

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

From: Branko Čibej <brane_at_apache.org>
Date: Fri, 11 Nov 2016 14:02:06 +0100

On 07.11.2016 11:56, Doros Agathangelou wrote:
> 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.

The biggest problem here is that your patch makes an incompatible change
in the public JavaHL API. In other words, everyone who's currently using
JavaHL's ISVNClient.logMessages() method will assume that passing a null
revProps parameter will return no revision properties. With your change,
it would return /all/ revision properties. That kind of change is not
acceptable.

One solution would be to introduce an overload of the
ISVNClient.logMessages() method that would have the option to return all
revprops.

-- Brane

P.S.: If you're going to work on such a patch, please read the relevant
sections of our Community Guide regarding code formatting, notably:
http://subversion.apache.org/docs/community-guide/conventions.html#coding-style
http://subversion.apache.org/docs/community-guide/conventions.html#other-conventions
http://subversion.apache.org/docs/community-guide/conventions.html#log-messages
Received on 2016-11-11 14:02:17 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.