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

XMLWordPrintable

    • Type: Task
    • Resolution: Fixed
    • Priority: P4
    • 20
    • Affects Version/s: 20
    • Component/s: 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 )

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

              Created:
              Updated:
              Resolved: