From 004045b1b6f295dde9811a92a8781447aebbf006 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Tue, 14 Oct 2003 13:54:54 +0000 Subject: [PATCH] Don't silently swallow exceptions when something is wrong, PR 23609 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275494 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/tools/ant/taskdefs/ProcessDestroyer.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java b/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java index c3ff0bca1..8a59902eb 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java +++ b/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java @@ -116,8 +116,10 @@ class ProcessDestroyer implements Runnable { 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 @@ class ProcessDestroyer implements Runnable { 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 @@ class ProcessDestroyer implements Runnable { } // 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 @@ class ProcessDestroyer implements Runnable { destroyProcessThread = null; added = false; } catch (IllegalAccessException e) { + e.printStackTrace(); } catch (InvocationTargetException e) { + e.printStackTrace(); } } }