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

(cs) Inconsistent docs for CharsetDecoder.replaceWith and CharsetEncoder.replaceWith

    XMLWordPrintable

Details

    Backports

      Description

        The API documentation for CharsetEncoder.replaceWith() gives the following
        information for the "newReplacement" parameter:

           newReplacement - The new replacement; must not be null, must have
           non-zero length, must not be longer than the value returned by the
           maxBytesPerChar method, and must be legal

           
        http://docs.oracle.com/javase/7/docs/api/java/nio/charset/CharsetEncoder.html#replaceWith(byte[])

        The equivalent section of documentation for CharsetDecoder.replaceWith()
        looks like this:

           newReplacement - The new replacement; must not be null and must have
           non-zero length

           
        http://docs.oracle.com/javase/7/docs/api/java/nio/charset/CharsetDecoder.html#replaceWith(java.lang.String)

        Note that the part about the maximum length of the parameter is missing.
        The implementation reveals that the length of newReplacement is checked
        against the value returned by CharsetDecoder.maxCharsPerByte(). Therefore
        we would expect the documentation to read as follows:

           newReplacement - The new replacement; must not be null, must have
           non-zero length, must not be longer than the value returned by the
           maxCharsPerByte method, and must be legal


        Attachments

          Issue Links

            Activity

              People

                igerasim Ivan Gerasimov
                shadowbug Shadow Bug
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: