On 9/27/06, Denis Kishenko <[EMAIL PROTECTED]> 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) <[EMAIL PROTECTED]>:
> [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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Richard Liang
China Development Lab, IBM

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to