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/27 16:04:22 UTC

[classlib][awt] Non bug??? RI AffineTransform.transform(...) throws ArrayIndexOutOfBoundsException while Harmony doesn't

Hi all

RI implementation of AffineTransform of transform(float[], int,
float[], int, int) and transform(double[], int, double[], int, int)
methods throws ArrayIndexOutOfBoundsException if offset is out of
bounds and number of points to transform is zero. Harmony doesn't
throw any exception. Spec doesn't say about any exceptions.

RI use System.arraycopy(...) (see track trace) which throws this
exception. But Harmony doesn't use System.arraycopy(...) so we have
difference in behavior.

I see two possibilities
1. Stay as non-bug. If number of points is zero then logically we have
to do nothing w/o exceptions.
2. Follow RI. In this case we have to add checks like this
if (srcOff > src.length || dstOff > dst.length) {
   throw new ArrayIndexOutOfBoundsException(...);
}
it looks a bit strange from my point of view.

I vote for non-bug.

Comments?


2006/9/27, Denis Kishenko (JIRA) <ji...@apache.org>:
> [classlib][awt] RI AffineTransform.transform(...) throws ArrayIndexOutOfBoundsException while Harmony doesn't
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1606
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1606
>             Project: Harmony
>          Issue Type: Bug
>          Components: Non-bug differences from RI
>            Reporter: Denis Kishenko
>
>
> RI implementation of AffineTransform of transform(float[], int, float[], int, int) and transform(double[], int, double[], int, int) methods throws ArrayIndexOutOfBoundsException if offsets are out of buffer bounds and number of points to transform is zero. Harmony doesn't throw any exception. Spec doesn't say about any exceptions.
>
> As you see from stack trace RI call System.arraycopy(...) which throws exception because of offset is really out of bounds. But Harmony implementation doesn't use System.arraycopy(...) so we have difference in behavior.
>
> =========== Test.java ===============
> import java.awt.geom.AffineTransform;
>
> public class Test {
>    static public void main(String[] args) {
>        AffineTransform t = new AffineTransform();
>        try {
>            t.transform(new float[] {}, 1, new float[] {}, 2, 0);
>        } catch (Exception e) {
>            e.printStackTrace();
>        }
>        try {
>            t.transform(new double[] {}, 1, new double[] {}, 2, 0);
>        } catch (Exception e) {
>            e.printStackTrace();
>        }
>    }
> }
>
> ========= RI =======================
> java.lang.ArrayIndexOutOfBoundsException
>    at java.lang.System.arraycopy(Ljava.lang.Object;ILjava.lang.Object;II)V(Unknown Source)
>    at java.awt.geom.AffineTransform.transform(AffineTransform.java:2308)
>    at Test.main(Test.java:10)
> java.lang.ArrayIndexOutOfBoundsException
>    at java.lang.System.arraycopy(Ljava.lang.Object;ILjava.lang.Object;II)V(Unknown Source)
>    at java.awt.geom.AffineTransform.transform(AffineTransform.java:2421)
>    at Test.main(Test.java:15)
>
> ======== 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: [classlib][awt] Non bug??? RI AffineTransform.transform(...) throws ArrayIndexOutOfBoundsException while Harmony doesn't

Posted by Oleg Khaschansky <ol...@gmail.com>.
+1 for the non-bug diff.

My opinion is that this boundary case is not going to affect any
application, especially because Harmony doesn't throw an exception
while RI does. Also, when the number of points is positive Harmony
still throws an exception if offset is out of bounds.

On 9/28/06, Denis Kishenko <dk...@gmail.com> wrote:
> According to our "Compatibility Guidelines"
>
> ...There are a few occasions where both the specification is quiet on
> a given issue, and the RI exhibits behaviour that we would consider
> illogical. In such cases we discuss the issue on the Harmony
> developers' mailing list, and code the class libraries to do what the
> development community conclude is "the logical thing"...
>
> So we have 1 vote for non-bug and 1 vote for bug.
>
> 2006/9/28, Richard Liang <ri...@gmail.com>:
> > On 9/27/06, Denis Kishenko <dk...@gmail.com> wrote:
> > > Hi all
> > >
> > > RI implementation of AffineTransform of transform(float[], int,
> > > float[], int, int) and transform(double[], int, double[], int, int)
> > > methods throws ArrayIndexOutOfBoundsException if offset is out of
> > > bounds and number of points to transform is zero. Harmony doesn't
> > > throw any exception. Spec doesn't say about any exceptions.
> > >
> > > RI use System.arraycopy(...) (see track trace) which throws this
> > > exception. But Harmony doesn't use System.arraycopy(...) so we have
> > > difference in behavior.
> > >
> > > I see two possibilities
> > > 1. Stay as non-bug. If number of points is zero then logically we have
> > > to do nothing w/o exceptions.
> > > 2. Follow RI. In this case we have to add checks like this
> > > if (srcOff > src.length || dstOff > dst.length) {
> > >    throw new ArrayIndexOutOfBoundsException(...);
> > > }
> > > it looks a bit strange from my point of view.
> > >
> > > I vote for non-bug.
> > >
> > > Comments?
> > >
> >
> > Hello Denis,
> >
> > According to our "Compatibility Guidelines"[1], I suggest we follow RI
> > for this issue though you may feel uncomfortable about the additional
> > code ;-)
> >
> > [1]http://incubator.apache.org/harmony/subcomponents/classlibrary/compat.html
> >
> > Best regards,
> > Richard
> > >
> > > 2006/9/27, Denis Kishenko (JIRA) <ji...@apache.org>:
> > > > [classlib][awt] RI AffineTransform.transform(...) throws ArrayIndexOutOfBoundsException while Harmony doesn't
> > > > -------------------------------------------------------------------------------------------------------------
> > > >
> > > >                 Key: HARMONY-1606
> > > >                 URL: http://issues.apache.org/jira/browse/HARMONY-1606
> > > >             Project: Harmony
> > > >          Issue Type: Bug
> > > >          Components: Non-bug differences from RI
> > > >            Reporter: Denis Kishenko
> > > >
> > > >
> > > > RI implementation of AffineTransform of transform(float[], int, float[], int, int) and transform(double[], int, double[], int, int) methods throws ArrayIndexOutOfBoundsException if offsets are out of buffer bounds and number of points to transform is zero. Harmony doesn't throw any exception. Spec doesn't say about any exceptions.
> > > >
> > > > As you see from stack trace RI call System.arraycopy(...) which throws exception because of offset is really out of bounds. But Harmony implementation doesn't use System.arraycopy(...) so we have difference in behavior.
> > > >
> > > > =========== Test.java ===============
> > > > import java.awt.geom.AffineTransform;
> > > >
> > > > public class Test {
> > > >    static public void main(String[] args) {
> > > >        AffineTransform t = new AffineTransform();
> > > >        try {
> > > >            t.transform(new float[] {}, 1, new float[] {}, 2, 0);
> > > >        } catch (Exception e) {
> > > >            e.printStackTrace();
> > > >        }
> > > >        try {
> > > >            t.transform(new double[] {}, 1, new double[] {}, 2, 0);
> > > >        } catch (Exception e) {
> > > >            e.printStackTrace();
> > > >        }
> > > >    }
> > > > }
> > > >
> > > > ========= RI =======================
> > > > java.lang.ArrayIndexOutOfBoundsException
> > > >    at java.lang.System.arraycopy(Ljava.lang.Object;ILjava.lang.Object;II)V(Unknown Source)
> > > >    at java.awt.geom.AffineTransform.transform(AffineTransform.java:2308)
> > > >    at Test.main(Test.java:10)
> > > > java.lang.ArrayIndexOutOfBoundsException
> > > >    at java.lang.System.arraycopy(Ljava.lang.Object;ILjava.lang.Object;II)V(Unknown Source)
> > > >    at java.awt.geom.AffineTransform.transform(AffineTransform.java:2421)
> > > >    at Test.main(Test.java:15)
> > > >
> > > > ======== 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
> > >
> > >
> >
> >
> > --
> > Richard Liang
> > China Development Lab, IBM
> >
> > ---------------------------------------------------------------------
> > 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
> >
> >
>
>
> --
> 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
>
>

---------------------------------------------------------------------
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: [classlib][awt] Non bug??? RI AffineTransform.transform(...) throws ArrayIndexOutOfBoundsException while Harmony doesn't

Posted by Denis Kishenko <dk...@gmail.com>.
According to our "Compatibility Guidelines"

...There are a few occasions where both the specification is quiet on
a given issue, and the RI exhibits behaviour that we would consider
illogical. In such cases we discuss the issue on the Harmony
developers' mailing list, and code the class libraries to do what the
development community conclude is "the logical thing"...

So we have 1 vote for non-bug and 1 vote for bug.

2006/9/28, Richard Liang <ri...@gmail.com>:
> On 9/27/06, Denis Kishenko <dk...@gmail.com> wrote:
> > Hi all
> >
> > RI implementation of AffineTransform of transform(float[], int,
> > float[], int, int) and transform(double[], int, double[], int, int)
> > methods throws ArrayIndexOutOfBoundsException if offset is out of
> > bounds and number of points to transform is zero. Harmony doesn't
> > throw any exception. Spec doesn't say about any exceptions.
> >
> > RI use System.arraycopy(...) (see track trace) which throws this
> > exception. But Harmony doesn't use System.arraycopy(...) so we have
> > difference in behavior.
> >
> > I see two possibilities
> > 1. Stay as non-bug. If number of points is zero then logically we have
> > to do nothing w/o exceptions.
> > 2. Follow RI. In this case we have to add checks like this
> > if (srcOff > src.length || dstOff > dst.length) {
> >    throw new ArrayIndexOutOfBoundsException(...);
> > }
> > it looks a bit strange from my point of view.
> >
> > I vote for non-bug.
> >
> > Comments?
> >
>
> Hello Denis,
>
> According to our "Compatibility Guidelines"[1], I suggest we follow RI
> for this issue though you may feel uncomfortable about the additional
> code ;-)
>
> [1]http://incubator.apache.org/harmony/subcomponents/classlibrary/compat.html
>
> Best regards,
> Richard
> >
> > 2006/9/27, Denis Kishenko (JIRA) <ji...@apache.org>:
> > > [classlib][awt] RI AffineTransform.transform(...) throws ArrayIndexOutOfBoundsException while Harmony doesn't
> > > -------------------------------------------------------------------------------------------------------------
> > >
> > >                 Key: HARMONY-1606
> > >                 URL: http://issues.apache.org/jira/browse/HARMONY-1606
> > >             Project: Harmony
> > >          Issue Type: Bug
> > >          Components: Non-bug differences from RI
> > >            Reporter: Denis Kishenko
> > >
> > >
> > > RI implementation of AffineTransform of transform(float[], int, float[], int, int) and transform(double[], int, double[], int, int) methods throws ArrayIndexOutOfBoundsException if offsets are out of buffer bounds and number of points to transform is zero. Harmony doesn't throw any exception. Spec doesn't say about any exceptions.
> > >
> > > As you see from stack trace RI call System.arraycopy(...) which throws exception because of offset is really out of bounds. But Harmony implementation doesn't use System.arraycopy(...) so we have difference in behavior.
> > >
> > > =========== Test.java ===============
> > > import java.awt.geom.AffineTransform;
> > >
> > > public class Test {
> > >    static public void main(String[] args) {
> > >        AffineTransform t = new AffineTransform();
> > >        try {
> > >            t.transform(new float[] {}, 1, new float[] {}, 2, 0);
> > >        } catch (Exception e) {
> > >            e.printStackTrace();
> > >        }
> > >        try {
> > >            t.transform(new double[] {}, 1, new double[] {}, 2, 0);
> > >        } catch (Exception e) {
> > >            e.printStackTrace();
> > >        }
> > >    }
> > > }
> > >
> > > ========= RI =======================
> > > java.lang.ArrayIndexOutOfBoundsException
> > >    at java.lang.System.arraycopy(Ljava.lang.Object;ILjava.lang.Object;II)V(Unknown Source)
> > >    at java.awt.geom.AffineTransform.transform(AffineTransform.java:2308)
> > >    at Test.main(Test.java:10)
> > > java.lang.ArrayIndexOutOfBoundsException
> > >    at java.lang.System.arraycopy(Ljava.lang.Object;ILjava.lang.Object;II)V(Unknown Source)
> > >    at java.awt.geom.AffineTransform.transform(AffineTransform.java:2421)
> > >    at Test.main(Test.java:15)
> > >
> > > ======== 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
> >
> >
>
>
> --
> Richard Liang
> China Development Lab, IBM
>
> ---------------------------------------------------------------------
> 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
>
>


-- 
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: [classlib][awt] Non bug??? RI AffineTransform.transform(...) throws ArrayIndexOutOfBoundsException while Harmony doesn't

Posted by Richard Liang <ri...@gmail.com>.
On 9/27/06, Denis Kishenko <dk...@gmail.com> wrote:
> Hi all
>
> RI implementation of AffineTransform of transform(float[], int,
> float[], int, int) and transform(double[], int, double[], int, int)
> methods throws ArrayIndexOutOfBoundsException if offset is out of
> bounds and number of points to transform is zero. Harmony doesn't
> throw any exception. Spec doesn't say about any exceptions.
>
> RI use System.arraycopy(...) (see track trace) which throws this
> exception. But Harmony doesn't use System.arraycopy(...) so we have
> difference in behavior.
>
> I see two possibilities
> 1. Stay as non-bug. If number of points is zero then logically we have
> to do nothing w/o exceptions.
> 2. Follow RI. In this case we have to add checks like this
> if (srcOff > src.length || dstOff > dst.length) {
>    throw new ArrayIndexOutOfBoundsException(...);
> }
> it looks a bit strange from my point of view.
>
> I vote for non-bug.
>
> Comments?
>

Hello Denis,

According to our "Compatibility Guidelines"[1], I suggest we follow RI
for this issue though you may feel uncomfortable about the additional
code ;-)

[1]http://incubator.apache.org/harmony/subcomponents/classlibrary/compat.html

Best regards,
Richard
>
> 2006/9/27, Denis Kishenko (JIRA) <ji...@apache.org>:
> > [classlib][awt] RI AffineTransform.transform(...) throws ArrayIndexOutOfBoundsException while Harmony doesn't
> > -------------------------------------------------------------------------------------------------------------
> >
> >                 Key: HARMONY-1606
> >                 URL: http://issues.apache.org/jira/browse/HARMONY-1606
> >             Project: Harmony
> >          Issue Type: Bug
> >          Components: Non-bug differences from RI
> >            Reporter: Denis Kishenko
> >
> >
> > RI implementation of AffineTransform of transform(float[], int, float[], int, int) and transform(double[], int, double[], int, int) methods throws ArrayIndexOutOfBoundsException if offsets are out of buffer bounds and number of points to transform is zero. Harmony doesn't throw any exception. Spec doesn't say about any exceptions.
> >
> > As you see from stack trace RI call System.arraycopy(...) which throws exception because of offset is really out of bounds. But Harmony implementation doesn't use System.arraycopy(...) so we have difference in behavior.
> >
> > =========== Test.java ===============
> > import java.awt.geom.AffineTransform;
> >
> > public class Test {
> >    static public void main(String[] args) {
> >        AffineTransform t = new AffineTransform();
> >        try {
> >            t.transform(new float[] {}, 1, new float[] {}, 2, 0);
> >        } catch (Exception e) {
> >            e.printStackTrace();
> >        }
> >        try {
> >            t.transform(new double[] {}, 1, new double[] {}, 2, 0);
> >        } catch (Exception e) {
> >            e.printStackTrace();
> >        }
> >    }
> > }
> >
> > ========= RI =======================
> > java.lang.ArrayIndexOutOfBoundsException
> >    at java.lang.System.arraycopy(Ljava.lang.Object;ILjava.lang.Object;II)V(Unknown Source)
> >    at java.awt.geom.AffineTransform.transform(AffineTransform.java:2308)
> >    at Test.main(Test.java:10)
> > java.lang.ArrayIndexOutOfBoundsException
> >    at java.lang.System.arraycopy(Ljava.lang.Object;ILjava.lang.Object;II)V(Unknown Source)
> >    at java.awt.geom.AffineTransform.transform(AffineTransform.java:2421)
> >    at Test.main(Test.java:15)
> >
> > ======== 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
>
>


-- 
Richard Liang
China Development Lab, IBM

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