-
CSR
-
Resolution: Approved
-
P4
-
None
-
behavioral
-
minimal
-
Java API, System or security property
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:
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.
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.
- csr of
-
JDK-8182743 Ineffective use of volatile hurts performance of Charset.atBugLevel()
-
- Resolved
-
- relates to
-
JDK-4786884 (cs) Charset methods and constructors should reject empty names
-
- Closed
-
-
JDK-4853350 (cs) Charset{De,En}coder constructors should enforce average <= max
-
- Closed
-