JDK-8218884 : Release Note: StringBuffer(CharSequence) and StringBuilder(CharSequence) Throw NegativeArraySizeException for Negatively Sized Argument
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 13
  • Priority: P4
  • Status: Closed
  • Resolution: Delivered
  • Submitted: 2019-02-13
  • Updated: 2019-08-14
  • Resolved: 2019-08-14
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.

To download the current JDK release, click here.
JDK 13
13Resolved
Description
The behavior of `StringBuffer(CharSequence)` and `StringBuilder(CharSequence)` is changed for the argument reporting a negative length.  The constructors were inconsistently throwing either `NegativeArraySizeException` or `IndexOutOfBoundException`.  The new behavior is to always throw `NegativeArraySizeException` for any argument reporting a negative length.