harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Gray <chris.g...@kiffer.be>
Subject Re: [classlib] Exception-throwing compatibility question
Date Mon, 03 Jul 2006 12:34:19 GMT
In 1.4.2 it was a bug, but in 1.5.0 it's a feature. :-) What a difference a 
doc makes ...

Chris

On Monday 03 July 2006 14:12, Anton Luht wrote:
> Hello,
>
> There's one example that shows that not only code may contain bugs,
> but documentation also:
>
> 1.5.0 spec [1] says about java.io.BufferedWriter.write(String, int, int)
>
> If the value of the len parameter is negative then no characters are
> written. This is contrary to the specification of this method in the
> superclass, which requires that an IndexOutOfBoundsException be
> thrown.
>
> 1.4.2 spec [2] doesn't say this, but 1.4.2 JRE behaves as it was
> written according to 1.5 doc. If it is not said, we expect that
> BufferedWriter should behave like Writer in this case (throw an
> exception) so this behaviour is formally a bug. In fact this is just a
> gap in documentation.
>
> [1]
> http://java.sun.com/j2se/1.5.0/docs/api/java/io/BufferedWriter.html#write(j
>ava.lang.String,%20int,%20int) [2]
> http://java.sun.com/j2se/1.4.2/docs/api/java/io/BufferedWriter.html#write(j
>ava.lang.String,%20int,%20int)
>
> On 7/3/06, Tim Ellison <t.p.ellison@gmail.com> wrote:
> > Mikhail Loenko wrote:
> > > For the example I've started this thread with it seems that complying
> > > the spec is
> > > more appropriate there. But probably there are other examples that
> > > caused that the doc was worded the given way
> > >
> > > George and Tim could you please comment?
> >
> > What is the concrete example?  e.g. are these checked exceptions, ... ?
> > or NPE vs. IAE ...
> >
> > Regards,
> > Tim
> >
> > > 2006/6/30, Paulex Yang <paulex.yang@gmail.com>:
> > >> Anton Avtamonov wrote:
> > >> > On 6/30/06, Mikhail Loenko <mloenko@gmail.com> wrote:
> > >> >> But section "Exception-throwing compatibility" says that exceptions
> > >> >> are different
> > >> >> and we aim "to be fully compartible with the RI" "by matching
the
> > >> >> exception characteristics of each method".
> > >> >
> > >> > I believe that it is for "However, in most cases the specification
> > >> > does not describe all possible exceptions that may be thrown" case
> > >> > only.
> > >> > In case the spec is complete and not looks like a bug I would vote
> > >> > to follow the spec.
> > >>
> > >> +1 from me.
> > >>
> > >> > Wishes,
> > >>
> > >> --
> > >> Paulex Yang
> > >> China Software 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
> > >
> > > ---------------------------------------------------------------------
> > > 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
> >
> > --
> >
> > Tim Ellison (t.p.ellison@gmail.com)
> > IBM Java technology centre, UK.
> >
> > ---------------------------------------------------------------------
> > 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

-- 
Chris Gray        /k/ Embedded Java Solutions      BE0503765045
Embedded & Mobile Java, OSGi    http://www.k-embedded-java.com/
chris.gray@kiffer.be                             +32 3 216 0369


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