classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: StringBuffer question


From: Bryce McKinlay
Subject: Re: StringBuffer question
Date: Thu, 07 Mar 2002 14:32:09 +1300
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.7) Gecko/20011221

Eric Blake wrote:

So back to my original question: Is the bounds check in the current
Classpath implementation of setLength necessary, or am I justified in
breaking the above snippet by removing the bounds check and throwing
IndexOutOfBoundsException instead?


Iit would be nice to do that, and it would not be incorrect according to the JDK 1.4 docs.

However, in the JCL, setLength() and other StringBuffer methods are explicitly defined to throw the StringIndexOutOfBoundsException.

Although I'm usually inclined to follow the Javadoc spec in preference to the JCL, given that there is some chance that changing it would break exisiting code, in this case I think it is safer to stick with the existing behaviour.

regards

Bryce.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]