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

Chris Hegarty chris.hegarty at oracle.com
Wed Aug 14 21:33:44 UTC 2013

 > * @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"

Either is ok with me. Is it worth adding a test? or will JCK be updated 
to catch this.


On 14/08/2013 20:10, Xueming Shen wrote:
> Hi,
> Please help review the change to document the AIOBE exception
> for CRC32/Adler32.update() methods (may need a followup CCC).
> This has been the behavior probably from day one, but the exception
> is just not explicitly listed. Ideally it probably should be in
> Checksum.update(),
> but that probably is too late for a public interface that has been there
> for so many years.
> http://cr.openjdk.java.net/~sherman/7154662/webrev/
> Thanks!
> -Sherman

More information about the core-libs-dev mailing list