JDK-6952330 : Fix for 6933217 broke contract of StringBuffer.ensureCapacity
Type:Bug
Component:core-libs
Sub-Component:java.lang
Affected Version:7
Priority:P3
Status:Closed
Resolution:Fixed
OS:generic
CPU:generic
Submitted:2010-05-13
Updated:2011-03-08
Resolved:2011-03-08
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
The fix for 6933217 inadvertently changed the array expansion algorithm for StringBuffer (et al) ensureCapacity to simply double the size; however the specification requires that it expand by 2N+2.
Comments
PUBLIC COMMENTS
If it helps, I found an open test that should demonstrate it:
http://www.sourceware.org/cgi-bin/cvsweb.cgi/mauve/gnu/testlet/java/lang/StringBuffer/StringBufferTest.java?rev=1.7&content-type=text/x-cvsweb-markup&cvsroot=mauve
-kto