git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/branches/REL_2_BRANCH@353209
13f79535-47bb-0310-9956-
ffa450edef68
throws IOException, ArrayIndexOutOfBoundsException,
IllegalArgumentException
{
- if ((index < 0) || (index >= data.length))
+ if ((index < 0) || (data.length != 0 && index >= data.length))
{
throw new ArrayIndexOutOfBoundsException(
"illegal index: " + index + " into array of length "
+ data.length);
}
+ if (data.length == 0)
+ return; // nothing more to do.
if (stream == null)
{
throw new IllegalArgumentException("cannot write to nullstream");
// as expected
}
+
+ // verify proper behaviour with a 0 length dump on 0 length dataset
+ HexDump.dump(new byte[0], 0, new ByteArrayOutputStream(), 0, 0);
}
public void testToHex()