You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Denis Kishenko <dk...@gmail.com> on 2006/09/12 16:41:59 UTC

Re: [jira] Created: (HARMONY-1447) [classlib][awt] RI Polygon.add(int,int) throws exception after Polygon(new int[2], new int[2], 0)

Hi all

This issue looks like RI bug so I filed it as "Non-bug differences from RI".

Spec doesn't say about any exceptions. Even if Polygon created with
empty point buffer (not null but zero length), method addPoint()
should reallocate buffer to append new point but RI throws
ArrayIndexOutOfBoundsException exception.

================= Test.java ===================
import java.awt.*;

public class Test {
    static public void main(String[] args) {
        Polygon p = new Polygon(new int[2], new int[2], 0);
        p.addPoint(1, 1);
    }
}

============= RI ====================
java.lang.ArrayIndexOutOfBoundsException
    at java.awt.Polygon.addPoint(Polygon.java:262)
    at Test.main(Test.java:8)

=========== Harmony ================
nothing

Comments?

2006/9/12, Denis Kishenko (JIRA) <ji...@apache.org>:
> [classlib][awt] RI Polygon.add(int,int) throws exception after Polygon(new int[2], new int[2], 0)
> -------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1447
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1447
>             Project: Harmony
>          Issue Type: Bug
>          Components: Non-bug differences from RI
>            Reporter: Denis Kishenko
>
>
> Spec doesn't say about any exceptions. Even if Polygon created with empty point buffer (not null but zero length), method addPoint() should reallocate buffer to append new point but RI throws ArrayIndexOutOfBoundsException exception. Seems like RI bug.
>
> ================= Test.java ===================
> import java.awt.*;
>
> public class Test {
>    static public void main(String[] args) {
> //        Polygon p = new Polygon(); it works
>        Polygon p = new Polygon(new int[2], new int[2], 0);
>        p.addPoint(1, 1);
>    }
> }
>
> ============= RI ====================
> java.lang.ArrayIndexOutOfBoundsException
>    at java.awt.Polygon.addPoint(Polygon.java:262)
>    at Test.main(Test.java:8)
>
> =========== Harmony ================
> nothing
>
> --
> 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
>
>
>


-- 
Denis M. Kishenko
Intel Middleware Products Division

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: [jira] Created: (HARMONY-1447) [classlib][awt] RI Polygon.add(int,int) throws exception after Polygon(new int[2], new int[2], 0)

Posted by Ilya Okomin <il...@gmail.com>.
On 9/12/06, Denis Kishenko <dk...@gmail.com> wrote:
>
> Hi all
>
> This issue looks like RI bug so I filed it as "Non-bug differences from
> RI".
>
> Spec doesn't say about any exceptions. Even if Polygon created with
> empty point buffer (not null but zero length), method addPoint()
> should reallocate buffer to append new point but RI throws
> ArrayIndexOutOfBoundsException exception.
>
> ================= Test.java ===================
> import java.awt.*;
>
> public class Test {
>    static public void main(String[] args) {
>        Polygon p = new Polygon(new int[2], new int[2], 0);
>        p.addPoint(1, 1);
>    }
> }
>
> ============= RI ====================
> java.lang.ArrayIndexOutOfBoundsException
>    at java.awt.Polygon.addPoint(Polygon.java:262)
>    at Test.main(Test.java:8)
>
> =========== Harmony ================
> nothing
>
> Comments?


I would agree with you and vote for RI bug. New Point should be appended
without exceptions if the initial total number of points is 0, espessially
taking into account the code
       Polygon p = new Polygon();
       p.addPoint(1, 1);
behaves on RI as expected.

Thanks,
Ilya.


2006/9/12, Denis Kishenko (JIRA) <ji...@apache.org>:
> [classlib][awt] RI Polygon.add(int,int) throws exception after Polygon(new
int[2], new int[2], 0)
>
-------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1447
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1447
>             Project: Harmony
>          Issue Type: Bug
>          Components: Non-bug differences from RI
>            Reporter: Denis Kishenko
>
>
> Spec doesn't say about any exceptions. Even if Polygon created with empty
point buffer (not null but zero length), method addPoint() should reallocate
buffer to append new point but RI throws ArrayIndexOutOfBoundsException
exception. Seems like RI bug.
>
> ================= Test.java ===================
> import java.awt.*;
>
> public class Test {
>    static public void main(String[] args) {
> //        Polygon p = new Polygon(); it works
>        Polygon p = new Polygon(new int[2], new int[2], 0);
>        p.addPoint(1, 1);
>    }
> }
>
> ============= RI ====================
> java.lang.ArrayIndexOutOfBoundsException
>    at java.awt.Polygon.addPoint(Polygon.java:262)
>    at Test.main(Test.java:8)
>
> =========== Harmony ================
> nothing
>
> --
> 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
>
>
>


--
Denis M. Kishenko
Intel Middleware Products Division

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org





-- 
--
Ilya Okomin
Intel Middleware Products Division