JDK 9 RFR of 8130679: Writer/StringWriter.write methods do not specify index out bounds

Brian Burkhalter brian.burkhalter at oracle.com
Tue May 10 14:38:20 UTC 2016


Good catch, Pavel. I’ll update it again and refresh the webrev.

Thanks,

Brian

On May 10, 2016, at 7:32 AM, Pavel Rappo <pavel.rappo at oracle.com> wrote:

> Hold it right there :-)
> 
> There's an open issue about BufferedWriter
> 
>  https://bugs.openjdk.java.net/browse/JDK-8029804
> 
> So in this case what we've added in the @throws for
> java.io.BufferedWriter#write(java.lang.String, int, int) directly contradicts
> what it states two paragraphs above, doesn't it?
> 
>   * <p> If the value of the {@code len} parameter is negative then no
>   * characters are written.  This is contrary to the specification of this
>   * method in the {@linkplain java.io.Writer#write(java.lang.String,int,int)
>   * superclass}, which requires that an {@link IndexOutOfBoundsException} be
>   * thrown.
> 
> That doesn't look good.
> 
>> On 10 May 2016, at 14:48, Roger Riggs <Roger.Riggs at oracle.com> wrote:
>> 
>> Looks good Brian,
>> 
>> Thanks
>> 
>> 
>> On 5/10/2016 5:36 AM, Chris Hegarty wrote:
>>> On 10 May 2016, at 00:29, Brian Burkhalter <Brian.Burkhalter at oracle.com> wrote:
>>> 
>>>> Hi Roger,
>>>> 
>>>> So modified:
>>>> 
>>>> http://cr.openjdk.java.net/~bpb/8130679/webrev.01/
>>> This looks good to me.
>>> 
>>> I have to admit that I reviewed the current wording in Reader.read, but on
>>> reflection it would be better to update it to reflect this wording. But that is a
>>> separate, lower priority, issue.
>>> 
>>> -Chris.
>>> 
>>>> Thanks,
>>>> 
>>>> Brian
>>>> 
>>>> On May 9, 2016, at 2:56 PM, Roger Riggs <roger.riggs at oracle.com> wrote:
>>>>> Yes, I think that works well.
>>>>> 
>>>>> On 5/9/16 5:15 PM, Brian Burkhalter wrote:
>>>>>> So do you think that this form for example:
>>>>>> 
>>>>>> (common prefix)
>>>>>>    * @throws  IndexOutOfBoundsException
>>>>>>    *          If {@code off} is negative, or {@code len} is negative,
>>>>>>    *          or {@code off + len} is negative or greater than the length
>> 
> 




More information about the core-libs-dev mailing list