This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: String.getChars behaviour differs from Sun implementation
- To: Erwin Bolwidt <ejb at klomp dot org>
- Subject: Re: String.getChars behaviour differs from Sun implementation
- From: Tom Tromey <tromey at redhat dot com>
- Date: 24 May 2001 11:01:53 -0600
- Cc: <java at gcc dot gnu dot org>
- References: <Pine.LNX.4.33.0105241823170.5985-100000@galileo.zap.tm>
- Reply-To: tromey at redhat dot com
>>>>> "Erwin" == Erwin Bolwidt <ejb@klomp.org> writes:
Erwin> char[] array = new char[0];
Erwin> "foo".getChars(0, 3, array, 0);
Erwin> But it seems logical to me that you get a
Erwin> StringIndexOutOfBoundsException if the first two parameters of
Erwin> the getChars method are wrong (they point to the start and end
Erwin> character within the string) and an
Erwin> ArrayIndexOutOfBoundsException if the array is too small or the
Erwin> last argument, the start index in the array, is negative or too
Erwin> big.
I agree. This seems like the most logical approach to me as well. I
have a patch for this which I'll check in soon. I'm only going to put
it on the trunk though. I don't think this is critical enough for
3.0.
Tom