harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey Petrenko (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (HARMONY-2875) [classlib][awt] Compatibility: java.awt.image.Raster.getPixels() thows ArrayIndexOutOfBoundsException on Harmony and works silent on RI
Date Thu, 01 Mar 2007 15:02:51 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-2875?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Alexey Petrenko resolved HARMONY-2875.
--------------------------------------

    Resolution: Fixed

Since we do not need to override getPixels method in BandedSampleModel class I've just removed
it.
Test patch has been applied without changes.

Andrey, please verify that everything works as you expected.

> [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.


Mime
View raw message