RFR: JDK-7154662: {CRC32, Adler32}.update(byte[] b, int off, int len): undocumented ArrayIndexOutOfBoundsException

Xueming Shen xueming.shen at oracle.com
Thu Aug 15 17:05:05 UTC 2013


On 08/15/2013 05:15 AM, Florian Weimer wrote:
> On 08/14/2013 11:33 PM, Chris Hegarty wrote:
>>
>> > * @throws  ArrayIndexOutOfBoundsException
>> > *          if the {@code off} is negative, or the {@code len} is
>> > *          negative, or the {@code off+len} is greater than the
>> > *          length of the array {@code b}
>>
>> I agree that specifying this in CRC32 and Adler32 is the right thing to
>> do. Trivially I'd drop the 'the' before the arguments, or maybe take the
>> working from InputStream.read(byte[],int,int) :
>>
>>    "If off is negative, len is negative, or len is greater than b.length
>>     - off"
>
> The InputStream wording is much better because it correctly covers the off + len < 0 case. :-)
>

The one I have (without that "the") is the outputstream version. I would
assume it is equivalent to the inputstream version, given we have
exclude the off < 0 and len < 0 cases :-)

-Sherman



More information about the core-libs-dev mailing list