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

JavaHL propertyGet handling in org.tigris.subversion package

From: Conor MacNeill <conor_at_codefeed.com>
Date: Tue, 20 Nov 2012 15:09:32 +1100

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
Received on 2012-11-20 06:32:41 CET

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

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