You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Alexei Zakharov (JIRA)" <ji...@apache.org> on 2007/01/12 16:09:27 UTC

[jira] Closed: (HARMONY-2885) [classlib][awt] Compatibility: java.awt.image.Raster.createRaster() doesn't throw RasterFormatException if DataBuffer type is incorrect

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

Alexei Zakharov closed HARMONY-2885.
------------------------------------


verified by Alexander

> [classlib][awt] Compatibility: java.awt.image.Raster.createRaster() doesn't throw RasterFormatException if DataBuffer type is incorrect
> ---------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2885
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2885
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Ilya Okomin
>         Assigned To: Alexei Zakharov
>            Priority: Minor
>         Attachments: RasterDataTypes2885.patch, RasterDataTypes2885Test.patch
>
>
> java.awt.image.Raster.createRaster(SampleModel sm, DataBuffer db, Point location) doesn't throw RasterFormatException if DataBuffer type is not the same as SampleModel has as it is done on RI.
> Test case to reproduce, it fails on Harmony and passes on RI:
> ------------------ test.java --------------------
> import java.awt.Point;
> import java.awt.image.DataBuffer;
> import java.awt.image.DataBufferShort;
> import java.awt.image.Raster;
> import java.awt.image.RasterFormatException;
> import java.awt.image.SinglePixelPackedSampleModel;
> 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 testRun() {
>         int dataType = DataBuffer.TYPE_USHORT;
>         int w = 2;
>         int h = 26;
>         int[] array0 = new int[798];
>         SinglePixelPackedSampleModel sm = new SinglePixelPackedSampleModel(
>                 dataType, w, h, array0);
>         DataBufferShort localDataBufferShort = new DataBufferShort(1,1);
>         Point location = new Point();
>         try {
>             Raster localRaster = Raster.createRaster(sm, localDataBufferShort,
>                     location);
>             fail("RasterFormatException expected!");
>         } catch (RasterFormatException expectedException) {
>             // Expected
>             System.out.println(expectedException + " was thrown");
>         }
>     }
> }
> ---------------------------------------------------
> On RI output is:
> ============
> .java.awt.image.RasterFormatException: ShortComponentRasters must have short DataBuffers was thrown
> Time: 0,13
> OK (1 test)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira