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

Simplify the loop condition in sun.net.httpserver.Request constructor

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: P4 P4
    • 20
    • 20
    • core-libs
    • b10

      The constructor of sun.net.httpserver.Request has the following do/while loop:

      do {
                  startLine = readLine();
                  if (startLine == null) {
                      return;
                  }
                  /* skip blank lines */
              } while (startLine == null ? false : startLine.equals (""));

      There's a if condition within the loop which makes the while (startLine == null) check redundant. The loop condition can be simplified to make it much more simpler to read.

      (A contributor has a PR open for this change https://github.com/openjdk/jdk/pull/9571 )

            jpai Jaikiran Pai
            jpai Jaikiran Pai
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: