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

Javadoc for PrintStream is now incorrect

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 14
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b07

      Description

      FULL PRODUCT VERSION :


      ADDITIONAL OS VERSION INFORMATION :
      javadoc so platform is irrelevant

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      http://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html

      A DESCRIPTION OF THE PROBLEM :
      The class javadoc for PrintStream states

      "All characters printed by a PrintStream are converted into bytes using the platform's default character encoding."

      However there are now constructors that take an encoding (http://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html#PrintStream-java.io.File-java.lang.String-) which state

      "Creates a new print stream, without automatic line flushing, ***with the specified file and charset***. This convenience constructor creates the necessary intermediate OutputStreamWriter, which will encode characters using the provided charset."

      The statement in this constructors javadoc is at odds with the statement in the class javadoc (they are mutually exclusive). Assuming that the PrintStreams that take a charset option do the right thing then the class level javadoc is now incorrect and needs updating.


      ADDITIONAL REGRESSION INFORMATION:
      This is a regression form JDK 1.4 when the first constructor that took and encoding was introduced (subsequent constructors taking encodings where introduced in 1.5). This is not an option in the dropdown to select from.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Look at the javadoc links and read the class and constructor descriptions.

      http://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      There are not contradictions.
      ACTUAL -
      the javadoc contains multually exclusive statements about encoding at the class level and the constructor level.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      no source code is needed.
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      ignore what the API says. (this is not a good thing to do!)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bpb Brian Burkhalter
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: