From 648275616e663a005c61d610d17c8cc006b12903 Mon Sep 17 00:00:00 2001 From: Stephane Bailliez Date: Tue, 16 Jul 2002 12:48:22 +0000 Subject: [PATCH] Forgot to catch Errors while doing the diagnostics..making it totally useless when there is a ClassDefNotFoundError...that is...most of the time.. hem... git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273114 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/Diagnostics.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/org/apache/tools/ant/Diagnostics.java b/src/main/org/apache/tools/ant/Diagnostics.java index b0ae9733f..3a164684c 100644 --- a/src/main/org/apache/tools/ant/Diagnostics.java +++ b/src/main/org/apache/tools/ant/Diagnostics.java @@ -258,7 +258,7 @@ public final class Diagnostics { out.println("Download it at http://xml.apache.org/commons/"); } catch (InvocationTargetException e) { error = e.getTargetException() == null ? e : e.getTargetException(); - } catch (Exception e) { + } catch (Throwable e) { error = e; } // report error if something weird happens...this is diagnostic. @@ -274,11 +274,11 @@ public final class Diagnostics { * because Ant requires multiple libraries to compile and one of them * was missing when compiling Ant. * @param out the stream to print the tasks report to - * @param is the stream defining the mapping task name/classname, can be * null for a missing stream (ie mapping). */ private static void doReportTasksAvailability(PrintStream out){ - InputStream is = Main.class.getResourceAsStream("/org/apache/tools/ant/taskdefs/defaults.properties"); + InputStream is = Main.class.getResourceAsStream( + "/org/apache/tools/ant/taskdefs/defaults.properties"); if (is == null) { out.println("None available"); } else { @@ -293,6 +293,11 @@ public final class Diagnostics { props.remove(key); } catch (ClassNotFoundException e){ out.println(key + " : Not Available"); + } catch (NoClassDefFoundError e) { + String pkg = e.getMessage().replace('/', '.'); + out.println(key + " : Missing dependency " + pkg ); + } catch (Error e) { + out.println(key + " : Initialization error"); } } if (props.size() == 0){