Hi, George

I agree with your point.

Harmony should throw the same type exception as RI unless we  have
sufficient reason such as RI conflict with spec,

or RI's behaviour is illogical or Harmony can't produce the same exception
as RI.

On 5/11/06, George Harley <[EMAIL PROTECTED]> wrote:

Hi,

I would like to start a little discussion around JIRA issue 436 [1]
which deals with exception throwing compatibility between Harmony and
the RI. I feel it is important to reach a concrete agreement on this as
so far all of the participants in the issue seem to disagree about the
interpretation of the compatibility guidelines on our web site [2].

You can read the discussion for yourself on the JIRA page (it is only a
handful of comments) but if you are pressed for time the essentials are
this (IMHO - Nathan and Dmitry please feel free to fill in the gaps) :

* Currently the Harmony implementation of a few public methods in
StringBuffer and StringBuilder throw different runtime exceptions from
the RI under certain failure scenarios.

* Where the Javadoc mentions the exception type that ought to be thrown
it mentions a type (j.l.IndexOutOfBoundsException) but the Harmony and
RI implementations differ in that they are throwing different
*sub-types* of j.l.IndexOutOfBoundsException. The RI tends to throw
j.l.ArrayIndexOutOfBoundsException while Harmony tends to throw
j.l.StringIndexOutOfBoundsException.

* Dmitry (who raised the issue) believes that we should change the
Harmony code to throw the type named in the Javadoc/specification (i.e.
the supertype j.l.IndexOutOfBoundsException).

* Nathan believes that the code already abides by the specification and
that there is no need for any change in this area.


-1. It violates compatibility, although both behaviours abide by spec.

* Little old me thinks that there *is* a problem here but that the
solution is to do as the RI does and throw exceptions with the very same
runtime type as the RI. That's based on my interpretation of the
exception-throwing compatibility guidelines [2], in particular the
fragment "Harmony class library code should throw exceptions of the same
type as the RI".


+1

If I recall correctly we did agree to discuss such compatibility matters
on a case-by-case basis. So, dear reader, what do you think is the
correct course of action in this case ?

Best regards,
George


[1] http://issues.apache.org/jira/browse/HARMONY-436
[2]
http://incubator.apache.org/harmony/subcomponents/classlibrary/compat.html

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




--
Andrew Zhang
China Software Development Lab, IBM

Reply via email to