StringBuilder.append cannot throw IndexOutOfBoundsException

Alan Bateman Alan.Bateman at Sun.COM
Tue Jul 22 07:39:26 UTC 2008


Martin Buchholz wrote:
> This message contains bug report + fix.
>
> The spec for StringBuilder.append has an erroneous
>   @throws IndexOutOfBoundsException.
>
> (StringBuffer.append does not have the same problem)
>
> Here's the easy (except for the paperwork) fix:
>
> diff --git a/src/share/classes/java/lang/StringBuilder.java
> b/src/share/classes/java/lang/StringBuilder.java
> --- a/src/share/classes/java/lang/StringBuilder.java
> +++ b/src/share/classes/java/lang/StringBuilder.java
> @@ -175,7 +175,6 @@
>      }
>
>      /**
> -     * @throws IndexOutOfBoundsException {@inheritDoc}
>       */
>      public StringBuilder append(CharSequence s) {
>          if (s == null)
>
> Martin
>   
I don't this in the bug database so I've created:
  6728229: (str) StringBuilder.append(CharSequence) does not throw 
IndexOutOfBoundsException

-Alan.






More information about the core-libs-dev mailing list