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-2431) [classlib][awt] SinglePixelPackedSampleModel.getSamples() expected ArrayIndexOutOfBoundsException
Date Mon, 04 Dec 2006 13:51:21 GMT
[classlib][awt] SinglePixelPackedSampleModel.getSamples() expected ArrayIndexOutOfBoundsException
-------------------------------------------------------------------------------------------------

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


According to the specification for getSamples(int x,
                        int y,
                        int w,
                        int h,
                        int b,
                        int[] iArray,
                        DataBuffer data)
ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. 

Harmony does not throw ArrayIndexOutOfBoundsException if some int argument equals Integer.MAX_VALUE
while RI does. The same problem is for setPixels(int x,
                      int y,
                      int w,
                      int h,
                      int[] iArray,
                      DataBuffer data) method.

import java.awt.image.*;
import junit.framework.TestCase;
import java.awt.*;
public class test extends TestCase {

    public void testcase1() {                                           
        SinglePixelPackedSampleModel model = new SinglePixelPackedSampleModel(3,216,1,new
int[851]);                            
        model.getSamples(
                6,7,14,Integer.MAX_VALUE,0,                     
                new int[] { 0,0,0},
                new DataBufferDouble(7,5));                        
    }  
    public void testcase2() {                                                  
        SinglePixelPackedSampleModel model = new SinglePixelPackedSampleModel(1,127,3,0,new
int[970]);                  
        model.setPixels(
                Integer.MAX_VALUE,1,13,1,                       
                new int[] {},
                new DataBufferDouble(7,5));                                     
    }                                                                
}

Output on Sun 1.5
=================
.E.E
Time: 0,016
There were 2 errors:
1) testcase1(test)java.lang.ArrayIndexOutOfBoundsException: 1518
        at java.awt.image.DataBufferDouble.getElem(DataBufferDouble.java:166)
        at
java.awt.image.SinglePixelPackedSampleModel.getSamples(SinglePixelPackedSampleModel.java:542)
        at test.testcase1(test.java:8)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
2) testcase2(test)java.lang.ArrayIndexOutOfBoundsException: 2147483647
        at java.awt.image.DataBufferDouble.getElem(DataBufferDouble.java:166)
        at
java.awt.image.SinglePixelPackedSampleModel.setPixels(SinglePixelPackedSampleModel.java:667)
        at test.testcase2(test.java:15)
        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: 2,  Failures: 0,  Errors: 2

Output on Harmony+drlvm/j9:
===========================
..
Time: 0,015

OK (2 tests)

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