Checkout
Mark Phippard
committed
on 05 Aug 09
JavaHL: Fix issue #2979: javahl's SVNAdmin::load() sometimes passes a null
data buffer to the read() method of the caller's InputInterface.… Show more
JavaHL: Fix issue #2979: javahl's SVNAdmin::load() sometimes passes a null

data buffer to the read() method of the caller's InputInterface.

JNIUtil::makeByteArray was returning NULL when the requested byte[] length

was 0.  This in turn was provoked by a read(length=0) on the svn_stream_t

loading a repository dump.  read(0) is perfectly valid (albeit superfluous),

such as when parsing a property value with length zero.

The fix just returns a byte[] with length 0 as requested from JNIUtil.cpp.

[ in subversion/bindings/javahl/ ]

* tests/org/tigris/subversion/javahl/SVNAdminTests.java:

 (testLoadRepo): Added test for issue 2979

* tests/org/tigris/subversion/javahl/SVNTests.java

 (OneTest): Tweaked inner class optionally not to load sample files

  into the test repository.  Keep behavior expected by existing tests.

* tests/data/issue2979.dump

 Data for reproducible test case of issue #2979.

* native/JNIUtil.cpp

 (makeJByteArray) Do not treat byte[0] and NULL as equivalent.

Patch by: Dave Brown <dave.brown@wandisco.com>

Reviewed by: hwright Show less