You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by di...@apache.org on 2002/02/12 03:11:43 UTC

cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient HttpConnection.java

dion        02/02/11 18:11:43

  Modified:    httpclient/src/java/org/apache/commons/httpclient
                        HttpConnection.java
  Log:
  Patches for null host as per patch from Sean C. Sullivan
  
  Revision  Changes    Path
  1.7       +15 -8     jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection.java
  
  Index: HttpConnection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- HttpConnection.java	15 Jan 2002 20:32:00 -0000	1.6
  +++ HttpConnection.java	12 Feb 2002 02:11:43 -0000	1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection.java,v 1.6 2002/01/15 20:32:00 rwaldhoff Exp $
  - * $Revision: 1.6 $
  - * $Date: 2002/01/15 20:32:00 $
  + * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection.java,v 1.7 2002/02/12 02:11:43 dion Exp $
  + * $Revision: 1.7 $
  + * $Date: 2002/02/12 02:11:43 $
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
  @@ -78,7 +78,8 @@
    * pair, together with the relevant attributes.
    * </p>
    * @author Rod Waldhoff
  - * @version $Revision: 1.6 $ $Date: 2002/01/15 20:32:00 $
  + * @author Sean C. Sullivan
  + * @version $Revision: 1.7 $ $Date: 2002/02/12 02:11:43 $
    */
   public class HttpConnection {
       // ----------------------------------------------------------- Constructors
  @@ -117,12 +118,15 @@
        * Fully-specified constructor.
        * @param proxyHost the host I should proxy via
        * @param proxyPort the port I should proxy via
  -     * @param host the host I should connect to
  +     * @param host the host I should connect to. Parameter value must be non-null.
        * @param port the port I should connect to
        * @param secure when <tt>true</tt>, connect via HTTPS (SSL)
        */
       public HttpConnection(String proxyHost, int proxyPort, String host, int port, boolean secure) {
           log.debug("HttpConnection.HttpConnection");
  +        if (host == null) {
  +            throw new NullPointerException("host parameter is null");
  +        }
           _proxyHost = proxyHost;
           _proxyPort = proxyPort;
           _host = host;
  @@ -142,10 +146,13 @@
   
       /**
        * Set my host.
  -     * @param host the host I should connect to
  +     * @param host the host I should connect to. Parameter value must be non-null.
        * @throws IllegalStateException if I am already connected
        */
       public void setHost(String host) throws IllegalStateException {
  +        if (host == null) {
  +            throw new NullPointerException("host parameter is null");
  +        }
           assertNotOpen();
           _host = host;
       }
  @@ -266,10 +273,10 @@
           log.debug("HttpConnection.open()");
           assertNotOpen(); // ??? is this worth doing?
           try {
  -            if(null == _socket) {
  +            if (null == _socket) {
                   String host = (null == _proxyHost) ? _host : _proxyHost;
                   int port = (null == _proxyHost) ? _port : _proxyPort;
  -                if(_ssl) {
  +                if (_ssl) {
                       _socket = SSLSocketFactory.getDefault().createSocket(host,port);
                   } else {
                       _socket = new Socket(host,port);
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>