From 81531e4ccc491acd422b705cfe427733b0c03834 Mon Sep 17 00:00:00 2001 From: Peter Reilly Date: Wed, 8 Sep 2004 09:43:50 +0000 Subject: [PATCH] Root cause of InstantiationException may be null in class.newInstance() git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276829 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/launch/Launcher.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/org/apache/tools/ant/launch/Launcher.java b/src/main/org/apache/tools/ant/launch/Launcher.java index cd34d448f..e0f620d58 100644 --- a/src/main/org/apache/tools/ant/launch/Launcher.java +++ b/src/main/org/apache/tools/ant/launch/Launcher.java @@ -223,9 +223,15 @@ public class Launcher { main.startAnt(newArgs, null, null); } catch (Throwable t) { if (t instanceof InstantiationException) { + t.printStackTrace(); InstantiationException ie = (InstantiationException) t; - System.err.println("Instantiation Exception - root cause:"); - ie.getCause().printStackTrace(); + if (ie.getCause() == null) { + System.err.println("Instantiation Exception - root cause: " + + ie.getCause()); + } else { + System.err.println("Instantiation Exception - root cause:"); + ie.getCause().printStackTrace(); + } } else { t.printStackTrace(); }