harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Zhang <zhanghuang...@gmail.com>
Subject Re: [classlib] matching RI exceptions -- are we required to have this type of compatibility?
Date Mon, 24 Apr 2006 07:27:23 GMT
Anton Avtamonov wrote:
> On 4/24/06, Mikhail Loenko <mloenko@gmail.com> wrote:
>> Look at HARMONY-387.
>>
>> Example:
>> 1) java.io.ByteArrayOutputStream.write(byte[] b , int off, int len):
>> Harmony throws ArrayIndexOutOfBoundsException when off<0 or/and len
>> <0, while RI throws IndexOutOfBoundsException.
>> Specification mentions neither ArrayIndexOutOfBoundsException nor
>> IndexOutOfBoundsException.
>>
>>
>> Actually ArrayIndexOutOfBoundsException is a sub class of
>> IndexOutOfBoundsException.
>>
>> So the statement "both Harmony and RI throw IndexOutOfBoundsException" is
>> true.
>>
>> But do we have to throw exactly those exceptions that are thrown by RI?

Yes. Harmony should throw the exactly same exception in this case.

> 
> I think so. If RI behavior is reasonable and doesn't contradict to the
> spec (as above) we should unconditionally copy RI behavior.
> 
+1.

Only When RI doesn't behave as spec or it's impossible for Harmony to 
throw the exact exception as RI(I don't know whether RI throws 
com.sun.internal.SunNullPointerException in some cases),  we should 
discuss whether to follow RI or follow spec or behave as Harmony style :)
> Really, why do we need additional differences even though we
> absolutely sure that particular minor deviation would have no impact
> on client apps?
> 
> 
>> Can we throw
>> o.a.h.VMRisenNPE that extends NullPointerException?
>>
>> What if they throw kind of
>> sun.internal.SunFavoriteSubClassOfNullPointerException ?
> 
> Yeah, in case RI operates with classes not from public API I would
> propose to base on spec. Or use the nearest class from public API if
> spec doesn't work for some reasons.
> Actually, spec even contains sometimes references to the classes from
> not public API...

> 
> Wishes,
> --
> Anton Avtamonov,
> 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


Mime
View raw message