JDK-8183116 : Drop property sun.nio.cs.bugLevel
  • Type: CSR
  • Component: core-libs
  • Sub-Component: java.nio.charsets
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 10
  • Submitted: 2017-06-28
  • Updated: 2018-04-05
  • Resolved: 2017-06-30
Related Reports
CSR :  
Relates :  
Relates :  
Description
Summary
-------

The method java.nio.charset.Charset.atBugLevel(String bl) and its uses shall be removed completely. This means not honoring the property "sun.nio.cs.bugLevel" at this place any longer. The bugLevel was used here to cause JDK 1.4 compatible behavior which is probably obsolete by now.

Problem
-------

The current problem resp. motivation why this should be done is to eliminate a volatile String member which causes performance penalties when accessing the bugLevel() method.

Solution
--------

Remove bugLevel() and drop the alternative handling for JDK 1.4 compatibility at the places where it is called.

Alternative would be to reimplement bugLevel() without volatile field.

Specification
-------------

The change implies that system property "sun.nio.cs.bugLevel" is ignored from now on. Before this change, one could set system property "sun.nio.cs.bugLevel=1.4" which would cause the following exceptional behavior to enable compatibility with JDK 1.4:<br>
a) When a constructor of Charset or any method that checks the supplied charset name is called with an empty name the result would be an UnsupportedCharsetException as opposed to the standard behavior to obtain an IllegalCharsetNameException.<br>
b) When the constructor of CharsetDecoder/CharsetEncoder is called, no check will be done whether the value of argument averageCharsPerByte exceeds the one of argument maxCharsPerByte. Usually one would get an IllegalArgumentException if averageCharsPerByte > maxCharsPerByte.

Comments
Moving the request to approved.
30-06-2017

@Christoph, to send this request through the second phase of CSR review, please "Finalize" the request. Once the CSR approves the finalized version of the request, the fix can be pushed to an integration forest. HTH.
29-06-2017

Hi Joe, I think your points are fulfilled now. What's the next step in the process? Do I need to move it to status "Proposed" again? Best regards Christoph
29-06-2017

I'm moving this request to provisional state. Please make a number of adjustments before Finalizing the request for the second round of CSR review. First, please have one or more other engineers review the request. Second, as the private method presumably isn't part of the end user visible API, please describe the change more so in terms of the impact on users "The system property sun.nio.cs.bugLevel is now ignored and method(s) XYZ no longer do ... as they did when property was set to ABC." If the system property is being removed, the Interface Kind should indicate that as well.
28-06-2017

Marking this as having Behavioral compatibility impact and the Java API interface kind. From reading the request, I assume the expected compatibility risk is minimal; please adjust and describe if it is note.
28-06-2017