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

BufferedReader.readLine() does not use System.getProperty("line.separator")

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 1.4.2
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_2000

      Description

      Name: rmT116609 Date: 04/07/2004


      FULL PRODUCT VERSION :
      java version "1.4.2"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
      Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      BufferedReader readLine method does not use line separator that is set in system properties. You are allowed to change line separator but it has not effect to the line parsing. Javadoc says:

      * Read a line of text. A line is considered to be terminated by any one
      * of a line feed ('\n'), a carriage return ('\r'), or a carriage return
      * followed immediately by a linefeed.

      And parsing code of readLine is below:

      for (i = nextChar; i < nChars; i++) {
          c = cb[i];
          if ((c == '\n') || (c == '\r')) {
      eol = true;
      break charLoop;
          }
      }

      Why are line separators hard coded? This sounds like a bug. readLine should use
      line separator that is set to the system property "line.separator".

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Check the readLine code from the BufferedReader.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      Check the code in readLine of BufferedReader
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      line parsing is changed to use line separator set in system properties (line.separator).
      (Incident Review ID: 225767)
      ======================================================================

        Attachments

          Activity

            People

            • Assignee:
              iris Iris Clark
              Reporter:
              rmandalasunw Ranjith Mandala (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: