harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Khaschansky (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-2712) [classlib][awt][compatibility] java.awt.image.Raster.createBandedRaster(int,int,int,int,int[],int[],Point) throws ArrayIndexOutOfBoundsException while Ri throws NPE
Date Thu, 14 Dec 2006 15:33:21 GMT
[classlib][awt][compatibility] java.awt.image.Raster.createBandedRaster(int,int,int,int,int[],int[],Point)
throws ArrayIndexOutOfBoundsException while Ri throws NPE
--------------------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-2712
                 URL: http://issues.apache.org/jira/browse/HARMONY-2712
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Oleg Khaschansky
            Priority: Trivial


RI throws unspecified NPE while Harmony throws specified ArrayIndexOutOfBoundsException. API
specification says: "ArrayIndexOutOfBoundsException - if bankIndices or bandOffsets is null".
This issue seems to be mostly RI problem. I think it is a non-bug difference from RI.

Testcase:

import junit.framework.TestCase;
import java.awt.Point;
import java.awt.image.Raster;
import java.awt.image.WritableRaster;
import java.awt.image.RasterFormatException;
public class test extends TestCase 
{
        public void testcase0()
        {
                int[] array0 = new int[] {};
                int[] array1 =null;
                Point localPoint = new Point(-17796, 8);
                try 
                {
                       
Raster.createBandedRaster(9,65412,5,-1,array0,array1,localPoint);
                        assertEquals(true, false);
                }
                catch (IllegalArgumentException expectedException) 
                {
                        fail(expectedException +" was thrown");
                }
                catch (ArrayIndexOutOfBoundsException expectedException) 
                {
                        System.out.println(expectedException +" was thrown");
                        assertEquals(true,true);
                }
  }
} 

OUTPUT:
Harmony+j9

.java.lang.ArrayIndexOutOfBoundsException: bankIndices or bandOffsets is null
was thrown

Time: 0.031

OK (1 test)

------------------------------------------------------------------------
Harmony+drlvm
.java.lang.ArrayIndexOutOfBoundsException: bankIndices or bandOffsets is null
was thrown

Time: 0.032

OK (1 test)
------------------------------------------------------------------------
RI
.E
Time: 0.125
There was 1 error:
1) testcase0(test)java.lang.NullPointerException
        at java.awt.image.Raster.createBandedRaster(Raster.java:362)
        at test.testcase0(test.java:16)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

FAILURES!!!
Tests run: 1,  Failures: 0,  Errors: 1

If array1 is just empty (not null!) RI also throws ArrayIndexOutOfBoundsException while Harmony
throws IllegalArgumentException , which is correct. So it's RI's behavior contradicts the
spec.


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