src/share/classes/java/lang/AbstractStringBuilder.java
Print this page
rev 6406 : 4247235: (spec str) StringBuffer.insert(int, char[]) specification is inconsistent
Summary: Add blanket null-handling statement to StringBuilder and StringBuffer
Reviewed-by: mduigou
*** 33,42 ****
--- 33,46 ----
* <p>
* Implements a modifiable string. At any point in time it contains some
* particular sequence of characters, but the length and content of the
* sequence can be changed through certain method calls.
*
+ * <p>Unless otherwise noted, passing a {@code null} argument to a constructor
+ * or method in this class will cause a {@link NullPointerException} to be
+ * thrown.
+ *
* @author Michael McCloskey
* @author Martin Buchholz
* @author Ulf Zibis
* @since 1.5
*/
*** 332,343 ****
*
* @param srcBegin start copying at this offset.
* @param srcEnd stop copying at this offset.
* @param dst the array to copy the data into.
* @param dstBegin offset into {@code dst}.
- * @throws NullPointerException if {@code dst} is
- * {@code null}.
* @throws IndexOutOfBoundsException if any of the following is true:
* <ul>
* <li>{@code srcBegin} is negative
* <li>{@code dstBegin} is negative
* <li>the {@code srcBegin} argument is greater than
--- 336,345 ----
*** 1280,1291 ****
* @param str any string.
* @return if the string argument occurs as a substring within this
* object, then the index of the first character of the first
* such substring is returned; if it does not occur as a
* substring, {@code -1} is returned.
- * @throws java.lang.NullPointerException if {@code str} is
- * {@code null}.
*/
public int indexOf(String str) {
return indexOf(str, 0);
}
--- 1282,1291 ----
*** 1301,1312 ****
*
* @param str the substring for which to search.
* @param fromIndex the index from which to start the search.
* @return the index within this string of the first occurrence of the
* specified substring, starting at the specified index.
- * @throws java.lang.NullPointerException if {@code str} is
- * {@code null}.
*/
public int indexOf(String str, int fromIndex) {
return String.indexOf(value, 0, count, str, fromIndex);
}
--- 1301,1310 ----
*** 1323,1334 ****
* @param str the substring to search for.
* @return if the string argument occurs one or more times as a substring
* within this object, then the index of the first character of
* the last such substring is returned. If it does not occur as
* a substring, {@code -1} is returned.
- * @throws java.lang.NullPointerException if {@code str} is
- * {@code null}.
*/
public int lastIndexOf(String str) {
return lastIndexOf(str, count);
}
--- 1321,1330 ----
*** 1344,1355 ****
*
* @param str the substring to search for.
* @param fromIndex the index to start the search from.
* @return the index within this sequence of the last occurrence of the
* specified substring.
- * @throws java.lang.NullPointerException if {@code str} is
- * {@code null}.
*/
public int lastIndexOf(String str, int fromIndex) {
return String.lastIndexOf(value, 0, count, str, fromIndex);
}
--- 1340,1349 ----