jdk/src/share/classes/java/lang/AbstractStringBuilder.java
changeset 6295 91f1c55cf47e
parent 5986 04eb44085c00
child 7020 25638687fe82
equal deleted inserted replaced
6294:27667aff0e1b 6295:91f1c55cf47e
   468      *             {@code end} is greater than {@code s.length()}
   468      *             {@code end} is greater than {@code s.length()}
   469      */
   469      */
   470     public AbstractStringBuilder append(CharSequence s, int start, int end) {
   470     public AbstractStringBuilder append(CharSequence s, int start, int end) {
   471         if (s == null)
   471         if (s == null)
   472             s = "null";
   472             s = "null";
   473         if ((start < 0) || (end < 0) || (start > end) || (end > s.length()))
   473         if ((start < 0) || (start > end) || (end > s.length()))
   474             throw new IndexOutOfBoundsException(
   474             throw new IndexOutOfBoundsException(
   475                 "start " + start + ", end " + end + ", s.length() "
   475                 "start " + start + ", end " + end + ", s.length() "
   476                 + s.length());
   476                 + s.length());
   477         int len = end - start;
   477         int len = end - start;
   478         ensureCapacityInternal(count + len);
   478         ensureCapacityInternal(count + len);
   527      * @throws IndexOutOfBoundsException
   527      * @throws IndexOutOfBoundsException
   528      *         if {@code offset < 0} or {@code len < 0}
   528      *         if {@code offset < 0} or {@code len < 0}
   529      *         or {@code offset+len > str.length}
   529      *         or {@code offset+len > str.length}
   530      */
   530      */
   531     public AbstractStringBuilder append(char str[], int offset, int len) {
   531     public AbstractStringBuilder append(char str[], int offset, int len) {
   532         ensureCapacityInternal(count + len);
   532         if (len > 0)                // let arraycopy report AIOOBE for len < 0
       
   533             ensureCapacityInternal(count + len);
   533         System.arraycopy(str, offset, value, count, len);
   534         System.arraycopy(str, offset, value, count, len);
   534         count += len;
   535         count += len;
   535         return this;
   536         return this;
   536     }
   537     }
   537 
   538