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:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>