harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Denis Kishenko (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-2435) [classlib][awt] Raster.createPackedRaster(...) throws RasterFormatException while RI throws IAE
Date Mon, 04 Dec 2006 14:10:21 GMT
[classlib][awt] Raster.createPackedRaster(...) throws RasterFormatException while RI throws
IAE
-----------------------------------------------------------------------------------------------

                 Key: HARMONY-2435
                 URL: http://issues.apache.org/jira/browse/HARMONY-2435
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Denis Kishenko


java.awt.image.Raster.createPackedRaster(int datatype, int w, int h, int[],Point) throws RasterFormatException
while RI throws IllegalArgumentException when datatype is not valid.
java 1.5.0 spec says:
"Throws: RasterFormatException - if w or h is less than or equal to zero, or computing
either location.x + w or location.y + h results in integer overflow 
IllegalArgumentException - if dataType is not one of the supported data types,
which are DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT".
It's a compatibility issue of exception order throwing.

============ Test ==============
import junit.framework.TestCase;
import java.awt.Point;
import java.awt.image.WritableRaster;
import java.awt.image.Raster;

public class test extends TestCase 
{
        public void testcase1() 
        {
                int localVariable0 = 109;
                int localVariable1 = -28;
                int localVariable2 = 3;
                int[] array0 = new int[] {};
                Point localPoint2 = new Point();
                Point localPoint1 = new Point(localPoint2);
                Point localPoint = new Point(localPoint1);
                try 
                {
                        Raster.createPackedRaster(
                                localVariable0,
                                localVariable1,
                                localVariable2,
                                array0,
                                localPoint);
                        assertEquals(true, false);
                } 
                catch (IllegalArgumentException e) 
                {e.printStackTrace();
                 assertEquals(true, true);
                }
        }
}
OUTPUT:
DEV :
Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software
Foundatio
n or its licensors, as applicable.
java version "1.5.0"
pre-alpha : not complete or compatible
svn = rsvn: '.' is not a working copy, (Sep 29 2006), Windows/ia32/msvc 1310,
de
bug build
http://incubator.apache.org/harmony
.E
Time: 0.031
There was 1 error:
1) testcase1(test)java.awt.image.RasterFormatException: w or h is less than or
e
qual to zero
        at java.awt.image.Raster.createPackedRaster(Raster.java:476)
        at test.testcase1(test.java:16)
        at java.lang.reflect.VMReflection.invokeMethod(Native Method)

FAILURES!!!
Tests run: 1,  Failures: 0,  Errors: 1
-----------------------------------------------------------------------
SUN
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
.java.lang.IllegalArgumentException: Unsupported data type 109
        at java.awt.image.Raster.createPackedRaster(Raster.java:462)
        at test.testcase1(test.java:19)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at junit.framework.TestCase.runTest(TestCase.java:154)
        at junit.framework.TestCase.runBare(TestCase.java:127)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        at junit.textui.TestRunner.doRun(TestRunner.java:116)
        at junit.textui.TestRunner.start(TestRunner.java:172)
        at junit.textui.TestRunner.main(TestRunner.java:138)

Time: 0.094

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