You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by se...@apache.org on 2010/01/16 14:37:38 UTC
svn commit: r899947 -
/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java
Author: sebb
Date: Sat Jan 16 13:37:37 2010
New Revision: 899947
URL: http://svn.apache.org/viewvc?rev=899947&view=rev
Log:
HTTPCORE-213 CharArrayBuffer.substring(int beginIndex, int endIndex) checks indexes unnecessarily
Modified:
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java?rev=899947&r1=899946&r2=899947&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java Sat Jan 16 13:37:37 2010
@@ -405,22 +405,13 @@
* @param beginIndex the beginning index, inclusive.
* @param endIndex the ending index, exclusive.
* @return the specified substring.
- * @exception IndexOutOfBoundsException if the
+ * @exception StringIndexOutOfBoundsException if the
* <code>beginIndex</code> is negative, or
* <code>endIndex</code> is larger than the length of this
* buffer, or <code>beginIndex</code> is larger than
* <code>endIndex</code>.
*/
public String substring(int beginIndex, int endIndex) {
- if (beginIndex < 0) {
- throw new IndexOutOfBoundsException("Negative beginIndex: "+beginIndex);
- }
- if (endIndex > this.len) {
- throw new IndexOutOfBoundsException("endIndex: "+endIndex+" > length: "+this.len);
- }
- if (beginIndex > endIndex) {
- throw new IndexOutOfBoundsException("beginIndex: "+beginIndex+" > endIndex: "+endIndex);
- }
return new String(this.buffer, beginIndex, endIndex - beginIndex);
}