Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8183116

Drop property sun.nio.cs.bugLevel

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 10
    • core-libs
    • 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.

            clanger Christoph Langer
            horii Hiroshi Horii (Inactive)
            Alan Bateman, Roger Riggs
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: