harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexander D Shipilov (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-2885) [classlib][awt] Compatibility: java.awt.image.Raster.createRaster() doesn't throw RasterFormatException if DataBuffer type is incorrect
Date Wed, 10 Jan 2007 13:34:27 GMT

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

Alexander D Shipilov updated HARMONY-2885:
------------------------------------------

    Attachment: RasterDataTypes2885.patch

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

        

Mime
View raw message