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

Florian Weimer fweimer at redhat.com
Thu Aug 15 12:15:52 UTC 2013


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. :-)

-- 
Florian Weimer / Red Hat Product Security Team



More information about the core-libs-dev mailing list