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

URL.openConnection should specify that the connection returned is unconnected

    Details

    • Subcomponent:
    • Resolved In Build:
      b18
    • CPU:
      sparc
    • OS:
      solaris_8
    • Verification:
      Not verified

      Backports

        Description

        Name: akR10050 Date: 08/26/2003



        URL.openConnection is the only way to get an instance of a URLConnection. Since
        1.5 there are new methods which can influence the process of establishing
        connection (for example, setConnectTimeout). Because of that, it should be
        explicitly specified that openConnection method of URL class does not in fact
        establish a connection (as the verb "open" implies), but rather instantiate
        appropriate URLConnection class and return an unconnected URLConnection.

        Here is what specification for URL.openConnection() states at the moment:
        -----------------------------------
        Returns a URLConnection object that represents a connection to the remote object
        referred to by the URL.

        A new connection is opened every time by calling the openConnection method of
        the protocol handler for this URL.
        -----------------------------------

        The above wording is very confusing because reader might think that the returned
        connection is already opened (i.e. actual connection to the remote socket is
        attempted). Possibility of IOException and unclear exception specification are
        yet another reasons to believe that the connection is actually established.

        The RI returns unconnected URLConnection (at least for HTTP).

        ======================================================================

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  jccollet Jean-Christophe Collet (Inactive)
                  Reporter:
                  kaisunw Kai Kai (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: