You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Philip Martin <ph...@wandisco.com> on 2012/11/20 13:01:14 UTC

[PATCH] JavaHL propertyGet handling in org.tigris.subversion package

Patches to the Subversion code should go to dev@s.a.o.

A log message that would help.  Look at old log messages for the code
and see the guidelines:
http://subversion.apache.org/docs/community-guide/conventions.html#log-messages

A regression test would also help.

Conor MacNeill <co...@codefeed.com> writes:

> Hi,
>
> I've been having a problem with the 1.7 JavaHL implementation in the
> org.tigris.subversion package. As I understand the code, this has been
> written as a wrapper around the new org.apache.subversion package. The
> propertyGet method is calling new String() around the byte[] value returned
> from the new interface's equivalent method. The problem is that when this
> returns null, the old interface method throws a NullPointerException rather
> than returning null.
>
> This is somewhat related to the discussion in
>
> http://subversion.tigris.org/issues/show_bug.cgi?id=3770
>
> although it's of a slightly different character.
>
> I suggest the following change:
>
> Index: SVNClient.java
> ===================================================================
> --- SVNClient.java    (revision 1411518)
> +++ SVNClient.java    (working copy)
> @@ -2110,10 +2110,10 @@
>      {
>          try
>          {
> -            return new PropertyData(path, name,
> -                    new String(aSVNClient.propertyGet(path, name,
> -                        revision == null ? null : revision.toApache(),
> -                        pegRevision == null ? null :
> pegRevision.toApache())));
> +            byte[] propertyBytes = aSVNClient.propertyGet(path, name,
> +                    revision == null ? null : revision.toApache(),
> +                    pegRevision == null ? null : pegRevision.toApache());
> +            return propertyBytes == null ? null : new PropertyData(path,
> name, new String(propertyBytes));
>          }
>          catch (org.apache.subversion.javahl.ClientException ex)
>          {
>
> What do you think?
>
> Cheers
> Conor

-- 
Certified & Supported Apache Subversion Downloads:
http://www.wandisco.com/subversion/download

Re: [PATCH] JavaHL propertyGet handling in org.tigris.subversion package

Posted by Vladimir Berezniker <vm...@hitechman.com>.
Hi Conor,

The org.tigris.subversion classes have been superseded by the ones in
the org.apache.subversion from what I know.  If you take a look at
SVNClient class there you will notice that the method has the
following signature:

    public native byte[] propertyGet(String path, String name,
Revision revision, Revision pegRevision)

This will return null byte array as you desire and will not attempt
any conversions to String.


On a related note, is there anything stopping your from using the API
in the  org.apache.subversion package rather than ones in the
org.tigris.subversion?

Cheers,

Vladimir

On Tue, Nov 20, 2012 at 7:01 AM, Philip Martin
<ph...@wandisco.com> wrote:
> Patches to the Subversion code should go to dev@s.a.o.
>
> A log message that would help.  Look at old log messages for the code
> and see the guidelines:
> http://subversion.apache.org/docs/community-guide/conventions.html#log-messages
>
> A regression test would also help.
>
> Conor MacNeill <co...@codefeed.com> writes:
>
>> Hi,
>>
>> I've been having a problem with the 1.7 JavaHL implementation in the
>> org.tigris.subversion package. As I understand the code, this has been
>> written as a wrapper around the new org.apache.subversion package. The
>> propertyGet method is calling new String() around the byte[] value returned
>> from the new interface's equivalent method. The problem is that when this
>> returns null, the old interface method throws a NullPointerException rather
>> than returning null.
>>
>> This is somewhat related to the discussion in
>>
>> http://subversion.tigris.org/issues/show_bug.cgi?id=3770
>>
>> although it's of a slightly different character.
>>
>> I suggest the following change:
>>
>> Index: SVNClient.java
>> ===================================================================
>> --- SVNClient.java    (revision 1411518)
>> +++ SVNClient.java    (working copy)
>> @@ -2110,10 +2110,10 @@
>>      {
>>          try
>>          {
>> -            return new PropertyData(path, name,
>> -                    new String(aSVNClient.propertyGet(path, name,
>> -                        revision == null ? null : revision.toApache(),
>> -                        pegRevision == null ? null :
>> pegRevision.toApache())));
>> +            byte[] propertyBytes = aSVNClient.propertyGet(path, name,
>> +                    revision == null ? null : revision.toApache(),
>> +                    pegRevision == null ? null : pegRevision.toApache());
>> +            return propertyBytes == null ? null : new PropertyData(path,
>> name, new String(propertyBytes));
>>          }
>>          catch (org.apache.subversion.javahl.ClientException ex)
>>          {
>>
>> What do you think?
>>
>> Cheers
>> Conor
>
> --
> Certified & Supported Apache Subversion Downloads:
> http://www.wandisco.com/subversion/download

Re: [PATCH] JavaHL propertyGet handling in org.tigris.subversion package

Posted by Vladimir Berezniker <vm...@hitechman.com>.
Hi Conor,

The org.tigris.subversion classes have been superseded by the ones in
the org.apache.subversion from what I know.  If you take a look at
SVNClient class there you will notice that the method has the
following signature:

    public native byte[] propertyGet(String path, String name,
Revision revision, Revision pegRevision)

This will return null byte array as you desire and will not attempt
any conversions to String.


On a related note, is there anything stopping your from using the API
in the  org.apache.subversion package rather than ones in the
org.tigris.subversion?

Cheers,

Vladimir

On Tue, Nov 20, 2012 at 7:01 AM, Philip Martin
<ph...@wandisco.com> wrote:
> Patches to the Subversion code should go to dev@s.a.o.
>
> A log message that would help.  Look at old log messages for the code
> and see the guidelines:
> http://subversion.apache.org/docs/community-guide/conventions.html#log-messages
>
> A regression test would also help.
>
> Conor MacNeill <co...@codefeed.com> writes:
>
>> Hi,
>>
>> I've been having a problem with the 1.7 JavaHL implementation in the
>> org.tigris.subversion package. As I understand the code, this has been
>> written as a wrapper around the new org.apache.subversion package. The
>> propertyGet method is calling new String() around the byte[] value returned
>> from the new interface's equivalent method. The problem is that when this
>> returns null, the old interface method throws a NullPointerException rather
>> than returning null.
>>
>> This is somewhat related to the discussion in
>>
>> http://subversion.tigris.org/issues/show_bug.cgi?id=3770
>>
>> although it's of a slightly different character.
>>
>> I suggest the following change:
>>
>> Index: SVNClient.java
>> ===================================================================
>> --- SVNClient.java    (revision 1411518)
>> +++ SVNClient.java    (working copy)
>> @@ -2110,10 +2110,10 @@
>>      {
>>          try
>>          {
>> -            return new PropertyData(path, name,
>> -                    new String(aSVNClient.propertyGet(path, name,
>> -                        revision == null ? null : revision.toApache(),
>> -                        pegRevision == null ? null :
>> pegRevision.toApache())));
>> +            byte[] propertyBytes = aSVNClient.propertyGet(path, name,
>> +                    revision == null ? null : revision.toApache(),
>> +                    pegRevision == null ? null : pegRevision.toApache());
>> +            return propertyBytes == null ? null : new PropertyData(path,
>> name, new String(propertyBytes));
>>          }
>>          catch (org.apache.subversion.javahl.ClientException ex)
>>          {
>>
>> What do you think?
>>
>> Cheers
>> Conor
>
> --
> Certified & Supported Apache Subversion Downloads:
> http://www.wandisco.com/subversion/download