You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Andrey Pavlenko (JIRA)" <ji...@apache.org> on 2007/01/22 16:32:30 UTC
[jira] Commented: (HARMONY-2431) [classlib][awt]
SinglePixelPackedSampleModel.getSamples() expected
ArrayIndexOutOfBoundsException
[ https://issues.apache.org/jira/browse/HARMONY-2431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12466479 ]
Andrey Pavlenko commented on HARMONY-2431:
------------------------------------------
The patch and the regression test are attached.
Please mark this issue as "Patch available".
> [classlib][awt] SinglePixelPackedSampleModel.getSamples() expected ArrayIndexOutOfBoundsException
> -------------------------------------------------------------------------------------------------
>
> Key: HARMONY-2431
> URL: https://issues.apache.org/jira/browse/HARMONY-2431
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Denis Kishenko
> Attachments: SinglePixelPackedSampleModel.patch, SinglePixelPackedSampleModelTest.patch
>
>
> 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: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira