On Mon, 23 Jan 2023 17:20:41 GMT, Andrey Turbanov <aturba...@openjdk.org> wrote:

> No need to fill elements of array with default values if it was just created. 
> Java guarantees that all elements of numeric array have default values after 
> allocations - 0.

src/java.desktop/share/classes/java/awt/image/ComponentColorModel.java line 521:

> 519:             {
> 520:                 byte[] bpixel = new byte[numComponents];
> 521:                 for (int i = 0; i < numColorComponents; i++) {

Is it possible that indirectly this code threw the AIOBE for some wrong 
"numColorComponents"?

src/java.desktop/share/classes/java/awt/image/Raster.java line 372:

> 370:         for (int i = 0; i < bands; i++) {
> 371:             bankIndices[i] = i;
> 372:             bandOffsets[i] = 0;

I suggest to comment this line and adding a comment like "0 zero is the default 
value not need to be set"

-------------

PR: https://git.openjdk.org/jdk/pull/12147

Reply via email to