JDK-7199551 : (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 8
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2012-09-19
  • Updated: 2014-02-05
  • Resolved: 2012-09-21
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.
8 b61Fixed
Related Reports
Relates :  
Relates :  
CharBuffer.append(CharSequence) throws BufferOverflowException instead of ReadOnlyBufferException on attemt to attempt to put a String into a read-only CharBuffer that has insufficient space. Formally we cannot consider that as conformance bug  because the spec does not explicitly state the order of checks. So any of the mentioned exceptions may be thrown in this case. Nevertheless that changes long-standing behavior and introduces some regression.

That issue caused the following JCK test failure:
The JCK test should also be fixed/relaxed to conform the specification (separate CR is submitted).

EVALUATION While reviewing this, it was also observed that the put(<type>Buffer) methods read one element from the source buffer before throwing ReadOnlyBufferException. This should also be fixed.

EVALUATION This is a behavioral change casued by 7190219.