You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Denis Kishenko (JIRA)" <ji...@apache.org> on 2006/12/04 14:51:21 UTC

[jira] Created: (HARMONY-2431) [classlib][awt] SinglePixelPackedSampleModel.getSamples() expected ArrayIndexOutOfBoundsException

[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

        

[jira] Updated: (HARMONY-2431) [classlib][awt] SinglePixelPackedSampleModel.getSamples() expected ArrayIndexOutOfBoundsException

Posted by "Alexei Zakharov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-2431?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Zakharov updated HARMONY-2431:
-------------------------------------

    Patch Info: [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.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (HARMONY-2431) [classlib][awt] SinglePixelPackedSampleModel.getSamples() expected ArrayIndexOutOfBoundsException

Posted by "Alexei Zakharov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-2431?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Zakharov resolved HARMONY-2431.
--------------------------------------

    Resolution: Fixed
      Assignee: Alexei Zakharov

Thanks, patches were applied at the revision 501410. Please verify.

> [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
>         Assigned To: Alexei Zakharov
>         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.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-2431) [classlib][awt] SinglePixelPackedSampleModel.getSamples() expected ArrayIndexOutOfBoundsException

Posted by "Andrey Pavlenko (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-2431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12468772 ] 

Andrey Pavlenko commented on HARMONY-2431:
------------------------------------------

Alexei, the patches have been applied properly, you can close the issue. Thanks.

> [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
>         Assigned To: Alexei Zakharov
>         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.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-2431) [classlib][awt] SinglePixelPackedSampleModel.getSamples() expected ArrayIndexOutOfBoundsException

Posted by "Andrey Pavlenko (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-2431?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrey Pavlenko updated HARMONY-2431:
-------------------------------------

    Attachment: SinglePixelPackedSampleModelTest.patch
                SinglePixelPackedSampleModel.patch

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

        

[jira] Closed: (HARMONY-2431) [classlib][awt] SinglePixelPackedSampleModel.getSamples() expected ArrayIndexOutOfBoundsException

Posted by "Alexei Zakharov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-2431?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Zakharov closed HARMONY-2431.
------------------------------------


verified by Andrey

> [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
>         Assigned To: Alexei Zakharov
>         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.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-2431) [classlib][awt] SinglePixelPackedSampleModel.getSamples() expected ArrayIndexOutOfBoundsException

Posted by "Andrey Pavlenko (JIRA)" <ji...@apache.org>.
    [ 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