Return-Path: Delivered-To: apmail-jakarta-cactus-dev-archive@apache.org Received: (qmail 8634 invoked from network); 9 Jul 2003 14:22:44 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 9 Jul 2003 14:22:44 -0000 Received: (qmail 20870 invoked by uid 97); 9 Jul 2003 14:25:11 -0000 Delivered-To: qmlist-jakarta-archive-cactus-dev@nagoya.betaversion.org Received: (qmail 20855 invoked from network); 9 Jul 2003 14:25:11 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 9 Jul 2003 14:25:11 -0000 Received: (qmail 8543 invoked by uid 500); 9 Jul 2003 14:22:42 -0000 Mailing-List: contact cactus-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Cactus Developers List" Reply-To: "Cactus Developers List" Delivered-To: mailing list cactus-dev@jakarta.apache.org Received: (qmail 8532 invoked by uid 500); 9 Jul 2003 14:22:42 -0000 Received: (qmail 8529 invoked from network); 9 Jul 2003 14:22:42 -0000 Received: from icarus.apache.org (208.185.179.13) by daedalus.apache.org with SMTP; 9 Jul 2003 14:22:42 -0000 Received: (qmail 15948 invoked by uid 1355); 9 Jul 2003 14:22:42 -0000 Date: 9 Jul 2003 14:22:42 -0000 Message-ID: <20030709142242.15947.qmail@icarus.apache.org> From: cmlenz@apache.org To: jakarta-cactus-cvs@apache.org Subject: cvs commit: jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container ContainerRunner.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N cmlenz 2003/07/09 07:22:42 Modified: integration/ant/src/java/org/apache/cactus/integration/ant/container ContainerRunner.java Log: Assume that the application is not deployed when connecting to the server is possible, but requests return non-successful status codes. This fixes a problem with the tests starting to get executed against a not-yet-initialized application under JBoss, and thus returning false test failures. Submitted by: Florin Vancea Revision Changes Path 1.4 +11 -6 jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/ContainerRunner.java Index: ContainerRunner.java =================================================================== RCS file: /home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/ContainerRunner.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ContainerRunner.java 14 Jun 2003 08:19:07 -0000 1.3 +++ ContainerRunner.java 9 Jul 2003 14:22:41 -0000 1.4 @@ -334,8 +334,9 @@ // Private Methods --------------------------------------------------------- /** - * Tests whether the resource pointed to by the specified HTTP URL is - * available. + * Tests whether we are able to connect to the HTTP server identified by the + * specified URL, and whether it responds with a HTTP status code indicating + * success (200 up to but excluding 300) for the requested resource. * * @param theUrl The URL to check * @return true if the test URL could be called without error, @@ -343,7 +344,7 @@ */ private boolean isAvailable(URL theUrl) { - boolean isUrlCallable = false; + boolean retVal = false; try { HttpURLConnection connection = @@ -352,13 +353,17 @@ connection.connect(); readFully(connection); connection.disconnect(); - isUrlCallable = true; + if ((connection.getResponseCode() != -1) + && (connection.getResponseCode() < 300)) + { + retVal = true; + } } catch (IOException e) { this.log.debug("Failed to connect to " + theUrl, e); } - return isUrlCallable; + return retVal; } /** --------------------------------------------------------------------- To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: cactus-dev-help@jakarta.apache.org