You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Alexander D Shipilov (JIRA)" <ji...@apache.org> on 2006/12/18 15:20:22 UTC

[jira] Updated: (HARMONY-2689) [classlib][awt] java.awt.image.RescaleOp.getOffsets() throws unexpected IAE if an array has zero legth size.

     [ http://issues.apache.org/jira/browse/HARMONY-2689?page=all ]

Alexander D Shipilov updated HARMONY-2689:
------------------------------------------

    Attachment: RescaleOp2689.patch

Patch to this bug

> [classlib][awt] java.awt.image.RescaleOp.getOffsets() throws unexpected IAE if an array has zero legth size.
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2689
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2689
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Ilya Okomin
>            Priority: Minor
>         Attachments: RescaleOp2689.patch
>
>
> There is no mention about any exception in the specification.
> Harmony throws IAE for RescaleOp.getOffsets(float[] offsets) if offsets is empty array while RI returns empty array.
> The same problem is for getScaleFactors(float[] scaleFactors) method.
> -------------- test.java -----------------
> import java.awt.image.*;
> import junit.framework.TestCase;
> import java.awt.*;
> public class test extends TestCase {
>     public void testcase1() {                                  
>         RescaleOp res = new RescaleOp(new float[1],new float[2],null);         
> assertEquals(res.getOffsets(new float[] {}).length, 0);                         
>     }
>     public void testcase2() {                           
>         RescaleOp res = new RescaleOp(new float[1],new float[2],null);         
> assertEquals(res.getScaleFactors(new float[] {}).length, 0);                    
>     }                                                                        
> }
> --------------------------------------
> Output on RI
> =================
> ..
> Time: 0
> OK (2 tests)
> Output on Harmony_drlvm/j9:
> ===========================
> .E.E
> Time: 0
> There were 2 errors:
> 1) testcase1(test)java.lang.ArrayIndexOutOfBoundsException
>         at java.lang.System.arraycopy(System.java:249)
>         at java.awt.image.RescaleOp.getOffsets(RescaleOp.java:92)
>         at test.testcase1(test.java:8)
>         at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:25)
> 2) testcase2(test)java.lang.ArrayIndexOutOfBoundsException
>         at java.lang.System.arraycopy(System.java:249)
>         at java.awt.image.RescaleOp.getScaleFactors(RescaleOp.java:83)
>         at test.testcase2(test.java:12)
>         at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:25)
> FAILURES!!!
> Tests run: 2,  Failures: 0,  Errors: 2
> This issue can be treated as non-bug difference, because it is unclear what is the appropriate result if sizes of given array and sizes of offsets and scaleFactors arrays in RescaleOp object are different. Otherwise, to be compatible with RI I can suggest to use min between argument array and RescaleOp object's array length as length param in j.l.System.arraycopy() call.

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