vmassol 01/04/14 07:55:18
Modified: cactus/src/ant/org/apache/commons/cactus/ant
StopServerHelper.java
Log:
check if server is already stopped. If so does nothing (thanks to Philip Aston)
Revision Changes Path
1.2 +10 -0
jakarta-commons/cactus/src/ant/org/apache/commons/cactus/ant/StopServerHelper.java
Index: StopServerHelper.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/cactus/src/ant/org/apache/commons/cactus/ant/StopServerHelper.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- StopServerHelper.java 2001/04/09 11:52:35 1.1
+++ StopServerHelper.java 2001/04/14 14:55:18 1.2
@@ -107,6 +107,16 @@
throw new BuildException("A stopTarget Ant target name must be
specified");
}
+ // Try connecting in case the server is already stopped.
+ try {
+ HttpURLConnection connection =
(HttpURLConnection)m_TestURL.openConnection();
+ connection.connect();
+ connection.disconnect();
+ } catch (IOException e) {
+ // Server is not running. Make this task a no-op.
+ return;
+ }
+
// Call the target that stops the server, in another thread.
Thread thread = new Thread(this);
thread.start();