You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Alexey Petrenko (JIRA)" <ji...@apache.org> on 2007/03/05 14:05:52 UTC
[jira] Closed: (HARMONY-2875) [classlib][awt] Compatibility:
java.awt.image.Raster.getPixels() thows ArrayIndexOutOfBoundsException on
Harmony and works silent on RI
[ https://issues.apache.org/jira/browse/HARMONY-2875?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alexey Petrenko closed HARMONY-2875.
------------------------------------
> [classlib][awt] Compatibility: java.awt.image.Raster.getPixels() thows ArrayIndexOutOfBoundsException on Harmony and works silent on RI
> ---------------------------------------------------------------------------------------------------------------------------------------
>
> Key: HARMONY-2875
> URL: https://issues.apache.org/jira/browse/HARMONY-2875
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Ilya Okomin
> Assigned To: Alexey Petrenko
> Priority: Minor
> Attachments: HARMONY-2875-BandedSampleModel.patch, HARMONY-2875-RasterTest.patch
>
>
> According to the specification for getPixels(int x,int y, int w, int h, int/float/double[] array)
> "An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed."
> a)Harmony does not throw ArrayIndexOutOfBoundsException if y==Integer.MAX_VALUE and preallocated array has integer type while RI does.
> b)Harmony throws ArrayIndexOutOfBoundsException if y==Integer.MAX_VALUE and preallocated array has float or double type while RI does not.
> Run next Test case to reproduce, it fails on Harmony and successfully passes on RI:
> ------------- test.java --------------
> import java.awt.Point;
> import java.awt.image.BandedSampleModel;
> import java.awt.image.DataBufferByte;
> import java.awt.image.Raster;
> import junit.framework.TestCase;
> import junit.textui.TestRunner;
> public class test extends TestCase {
> public static void main(String args[]) {
> TestRunner.run(test.class);
> }
> public void testCase1() {
> Raster rst = Raster.createRaster(new BandedSampleModel(1, 2, 3, 4),
> new DataBufferByte(new byte[191], 0),
> new Point(new Point(28, 43)));
> try {
> rst.getPixels(6, Integer.MAX_VALUE, 1, 0, new int[] {});
> fail("ArrayIndexOutOfBoundsException should be thrown");
> } catch (ArrayIndexOutOfBoundsException e) {
> //expected
> }
> }
> public void testCase2() {
> Raster rst = Raster.createRaster(new BandedSampleModel(1, 2, 3, 4),
> new DataBufferByte(new byte[191], 0),
> new Point(new Point(28,43)));
> rst.getPixels(6, Integer.MAX_VALUE, 1, 0, new float[] {});
> }
> public void testCase3() {
> Raster rst = Raster.createRaster(new BandedSampleModel(1, 2, 3, 4),
> new DataBufferByte(new byte[191], 0), new Point(new Point(28,
> 43)));
> rst.getPixels(6, Integer.MAX_VALUE, 1, 0, new double[] {});
> }
> }
> ----------------------------------------
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.