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

CharsetDecoder/Encoder's constructor does not reject NaN

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P5
    • Resolution: Approved
    • Fix Version/s: 12
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      NaN were not rejected, however it's extremely unlikely that any application relied on this behavior.
    • Interface Kind:
      Java API
    • Scope:
      Implementation

      Description

      Summary

      The constructors of CharsetDecoder and CharsetEncoder do not reject some invalid arguments values.

      Problem

      Specification states that the constructors of CharsetDecoder and CharsetEncoder only accept positive float numbers, and IllegalArgumentException is thrown for invalid values. However, NaN values are not rejected.

      Solution

      The implementation of the constructors of CharsetDecoder and CharsetEncoder will be updated, so that IllegalArgumentException will be thrown if one or both arguments are NaN.

      -        if (average$ItypesPerOtype$ <= 0.0f)
      +        if (!(average$ItypesPerOtype$ > 0.0f))
                   throw new IllegalArgumentException("Non-positive "
                                                      + "average$ItypesPerOtype$");
      -        if (max$ItypesPerOtype$ <= 0.0f)
      +        if (!(max$ItypesPerOtype$ > 0.0f))
                   throw new IllegalArgumentException("Non-positive "
                                                      + "max$ItypesPerOtype$");

      Specification

      Specification does not change.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                igerasim Ivan Gerasimov
                Reporter:
                igerasim Ivan Gerasimov
                Reviewed By:
                Roger Riggs
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: