From 9b29322cc46d2345c447ceca17d1f2dd6a54840d Mon Sep 17 00:00:00 2001 From: "Jesse N. Glick" Date: Tue, 8 Aug 2006 23:43:07 +0000 Subject: [PATCH] Avoid a useless exception being (sometimes) thrown if a task is halted with Thread.stop(). git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@429887 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java b/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java index 24faf683b..aae0eea28 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java +++ b/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java @@ -142,7 +142,10 @@ class ProcessDestroyer implements Runnable { // eligible for garbage collection // Cf.: http://developer.java.sun.com/developer/bugParade/bugs/4533087.html destroyProcessThread.setShouldDestroy(false); - destroyProcessThread.start(); + if (!destroyProcessThread.getThreadGroup().isDestroyed()) { + // start() would throw IllegalThreadStateException from ThreadGroup.add if it were destroyed + destroyProcessThread.start(); + } // this should return quickly, since it basically is a NO-OP. try { destroyProcessThread.join(20000);