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

HttpClient javadoc synchronous example missing HttpRequest variable declaration

XMLWordPrintable

    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      The synchronous example in HttpClient javadoc (lines 96-107) references
      an undefined 'request' variable, which causes a compilation error if
      someone copies the example code directly.

      File: src/java.net.http/share/classes/java/net/http/HttpClient.java
      Lines: 96-107

      The asynchronous example (lines 111-119) correctly shows the HttpRequest
      creation, but the synchronous example is missing this step.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Open HttpClient javadoc
      2. Copy the synchronous example code (lines 96-107)
      3. Try to compile it

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The example should compile and run without errors.
      The HttpRequest should be declared before being used in client.send().
      ACTUAL -
      Compilation error: 'request' variable is not defined

        1. test.java
          0.9 kB
          Patricia Tavares

            michaelm Michael McMahon
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: