You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Tim Ellison <t....@gmail.com> on 2006/07/03 12:18:15 UTC

Re: [classlib] Exception-throwing compatibility question

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 <pa...@gmail.com>:
>> Anton Avtamonov wrote:
>> > On 6/30/06, Mikhail Loenko <ml...@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


Re: [classlib] Exception-throwing compatibility question

Posted by Chris Gray <ch...@kiffer.be>.
On Monday 03 July 2006 14:33, Andrew Zhang wrote:
> Maybe it's called "javadoc bug or spec bug". :)

Looks to me very like "oops, our implementation isn't according to spec, 
better change the spec". To be fair to Sun, fixing the implementation could 
have broken existing code (maybe it did, hence the decision to "fix" the spec 
instead).

Chris


---------------------------------------------------------------------
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] Exception-throwing compatibility question

Posted by Andrew Zhang <zh...@gmail.com>.
Maybe it's called "javadoc bug or spec bug". :)

On 7/3/06, Chris Gray <ch...@kiffer.be> wrote:
>
> 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....@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 <pa...@gmail.com>:
> > > >> Anton Avtamonov wrote:
> > > >> > On 6/30/06, Mikhail Loenko <ml...@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
>
>


-- 
Andrew Zhang
China Software Development Lab, IBM

Re: [classlib] Exception-throwing compatibility question

Posted by Chris Gray <ch...@kiffer.be>.
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....@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 <pa...@gmail.com>:
> > >> Anton Avtamonov wrote:
> > >> > On 6/30/06, Mikhail Loenko <ml...@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


Re: [classlib] Exception-throwing compatibility question

Posted by Anton Luht <an...@gmail.com>.
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(java.lang.String,%20int,%20int)
[2] http://java.sun.com/j2se/1.4.2/docs/api/java/io/BufferedWriter.html#write(java.lang.String,%20int,%20int)


On 7/3/06, Tim Ellison <t....@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 <pa...@gmail.com>:
> >> Anton Avtamonov wrote:
> >> > On 6/30/06, Mikhail Loenko <ml...@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
>
>


-- 
Regards,
Anton Luht,
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