[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cp-patches] RFC: StringIndexOutOfBoundsException fixes in String co
From: |
Mark Wielaard |
Subject: |
Re: [cp-patches] RFC: StringIndexOutOfBoundsException fixes in String contructors |
Date: |
Wed, 02 Nov 2005 08:25:55 +0100 |
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 <address@hidden>
>
> * java/lang/String.java (String): Added
> StringIndexOutOfBoundsException check and a message to the
> exception.
Add the word (overflow) here also please.
Cheers,
Mark
signature.asc
Description: This is a digitally signed message part