You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by je...@apache.org on 2002/10/20 16:14:04 UTC

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

jericho     2002/10/20 07:14:04

  Modified:    httpclient/src/java/org/apache/commons/httpclient
                        HttpClient.java
  Log:
  - Add documents for the startSession(URI) method...
  - Make the startSession(URI) method throw IllegalStateExeption
    (change from IllegalArgumentExeption)
  
  Revision  Changes    Path
  1.58      +16 -10    jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpClient.java
  
  Index: HttpClient.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpClient.java,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- HttpClient.java	23 Sep 2002 16:37:06 -0000	1.57
  +++ HttpClient.java	20 Oct 2002 14:14:04 -0000	1.58
  @@ -266,8 +266,10 @@
        * <p>
        * Note that the path component is not utilized.
        * <p>
  -     * @param uri the {@link URI URI} from which the scheme, userinfo, host and
  -     * port of the session are determined
  +     * @param uri an <code>HttpURL</code> or <code>HttpsURL</code> instance; the
  +     * {@link URI URI} from which the scheme, userinfo, host and port of the
  +     * session are determined
  +     * @exception IllegalStateException not enough information to process
        * @see #startSession
        * @see #endSession
        */
  @@ -276,11 +278,13 @@
   
           String scheme = uri.getScheme();
           if (scheme == null) {   // it may a URI instance or abs_path
  -            throw new IllegalArgumentException("no scheme to start a session");
  +            log.error("no scheme to start a session");
  +            throw new IllegalStateException("no scheme to start a session");
           }
           boolean secure = scheme.equalsIgnoreCase("https") ? true : false;
           if (!(secure || scheme.equalsIgnoreCase("http"))) {
  -            throw new IllegalArgumentException
  +            log.error("http and https scheme only supported");
  +            throw new IllegalStateException
                   ("http and https scheme only supported");
           }
           String userinfo = uri.getUserinfo();
  @@ -290,11 +294,13 @@
           }
           String host = uri.getHost();
           if (host == null || host.length() == 0) {
  -            throw new IllegalArgumentException("no host to start a session");
  +            log.error("no host to start a session");
  +            throw new IllegalStateException("no host to start a session");
           }
           int port = uri.getPort();
           if (port == -1) {   // neither HttpURL or HttpsURL instance
  -            throw new IllegalArgumentException
  +            log.error("HttpURL or HttpsURL instance required");
  +            throw new IllegalStateException
                   ("HttpURL or HttpsURL instance required");
           }
           connection = new HttpConnection(host, port, secure);
  
  
  

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