commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jeri...@apache.org
Subject cvs commit: jakarta-commons/httpclient/src/examples TrivialApp.java
Date Mon, 23 Sep 2002 13:31:08 GMT
jericho     2002/09/23 06:31:08

  Modified:    httpclient/src/examples TrivialApp.java
  Log:
  - Replace the way using "instanceof" with the class hierarchy mechanism to catch exception...
     (It may depend on your taste.)
  
  Revision  Changes    Path
  1.3       +10 -12    jakarta-commons/httpclient/src/examples/TrivialApp.java
  
  Index: TrivialApp.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/examples/TrivialApp.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TrivialApp.java	22 Sep 2002 12:31:28 -0000	1.2
  +++ TrivialApp.java	23 Sep 2002 13:31:08 -0000	1.3
  @@ -123,15 +123,13 @@
           //execute the method
           try{
               client.executeMethod(method);
  -        }catch (IOException ioe){
  -            if (ioe instanceof HttpException){
  -                System.err.println("Http error connecting to '" + url + "'");
  -                System.err.println(((HttpException) ioe).getMessage());
  -                System.exit(-4);
  -            } else {
  -                System.err.println("Unable to connect to '" + url + "'");
  -                System.exit(-3);
  -            }
  +        } catch (HttpException he) {
  +            System.err.println("Http error connecting to '" + url + "'");
  +            System.err.println(he.getMessage());
  +            System.exit(-4);
  +        } catch (IOException ioe){
  +            System.err.println("Unable to connect to '" + url + "'");
  +            System.exit(-3);
           }
   
           //get the request headers
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message