bodewig 2003/10/14 06:54:54
Modified: src/main/org/apache/tools/ant/taskdefs ProcessDestroyer.java
Log:
Don't silently swallow exceptions when something is wrong, PR 23609
Revision Changes Path
1.12 +8 -3
ant/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java
Index: ProcessDestroyer.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- ProcessDestroyer.java 24 Jul 2003 13:29:37 -0000 1.11
+++ ProcessDestroyer.java 14 Oct 2003 13:54:54 -0000 1.12
@@ -116,8 +116,10 @@
removeShutdownHookMethod =
Runtime.class.getMethod("removeShutdownHook", paramTypes);
// wait to add shutdown hook as needed
- } catch (Exception e) {
+ } catch (NoSuchMethodException e) {
// it just won't be added as a shutdown hook... :(
+ } catch (Exception e) {
+ e.printStackTrace();
}
}
@@ -133,9 +135,9 @@
addShutdownHookMethod.invoke(Runtime.getRuntime(), args);
added = true;
} catch (IllegalAccessException e) {
- // it just won't be added as a shutdown hook... :(
+ e.printStackTrace();
} catch (InvocationTargetException e) {
- // it just won't be added as a shutdown hook... :(
+ e.printStackTrace();
}
}
}
@@ -157,6 +159,7 @@
}
// start the hook thread, a unstarted thread may not be
// eligible for garbage collection
+ // Cf.:
http://developer.java.sun.com/developer/bugParade/bugs/4533087.html
destroyProcessThread.setShouldDestroy(false);
destroyProcessThread.start();
// this should return quickly, since Process.destroy()
@@ -169,7 +172,9 @@
destroyProcessThread = null;
added = false;
} catch (IllegalAccessException e) {
+ e.printStackTrace();
} catch (InvocationTargetException e) {
+ e.printStackTrace();
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]