harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ilya Okomin (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-2885) [classlib][awt] Compatibility: java.awt.image.Raster.createRaster() doesn't throw RasterFormatException if DataBuffer type is incorrect
Date Wed, 27 Dec 2006 08:27:22 GMT
[classlib][awt] Compatibility: java.awt.image.Raster.createRaster() doesn't throw RasterFormatException
if DataBuffer type is incorrect
---------------------------------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-2885
                 URL: http://issues.apache.org/jira/browse/HARMONY-2885
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Ilya Okomin
            Priority: Minor


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: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message