Hi Christian,

On Tue, 2005-11-01 at 23:11 +0100, Christian Thalinger wrote:
> While fixing a CACAO problem in gnu.testlet.java.lang.String.StringTest,
> i noticed that we do not check one case:
> 
> offset + count < 0

Ugh. Overflow. Took me a little time to realize that. Could you add
(overflow) as comment to the doc?

> Thus we throw a ArrayIndexOutOfBoundsException instead of a
> StringIndexOutOfBoundsException.  The attached patch adds this checks
> and, while everybody is talking about better exception message, adds the
> index to the message.

For bonus points maybe add what the faulty index actually is to the
message like:

    if (offset + count < 0 || offset + count > ascii.length)
      throw new StringIndexOutOfBoundsException("offset + count: "
                                                + offset + count);

> Ok?

Yes thanks.

> 2005-11-01  Christian Thalinger  <[EMAIL PROTECTED]>
> 
>       * java/lang/String.java (String): Added         
>       StringIndexOutOfBoundsException check and a message to the 
>       exception.

Add the word (overflow) here also please.

Cheers,

Mark

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to