bugs.java.com
Bug ID: JDK-4524848 StringBuffer's setLength() Results in Unneeded...
The coding error is in the "StringBuffer.setLength()" method. If you change the return statement in the "buildSomeString()" method to "return sb.substring(0, sb.length());", the problem goes away. When a programmer sets the capacity of a StringBuffer, he does so to increase efficiency.