From d50c8c978bc3e7b7cb1769feac83ad3485399d77 Mon Sep 17 00:00:00 2001 From: Peter Reilly Date: Fri, 20 May 2005 16:44:56 +0000 Subject: [PATCH] If launcher gets an InstantiationException when using the default constructor of ant, change the error message to say that this is an incompatible version of ant main and attempt to print out the location of this class. Some jar files have old version of ant within them - (weblogic in particular) so this should help in showing if this is the case. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@278310 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 1 + src/main/org/apache/tools/ant/launch/Launcher.java | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/WHATSNEW b/WHATSNEW index 1136c46d5..aadefeb4a 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -211,6 +211,7 @@ Other changes: As it tests for the implementation, it can be used to check for optional tasks being available. +* check for 1.5.* ant main class. (weblogic.jar in classpath reports) Changes from Ant 1.6.3 to Ant 1.6.4 =================================== diff --git a/src/main/org/apache/tools/ant/launch/Launcher.java b/src/main/org/apache/tools/ant/launch/Launcher.java index 8afd0710a..80fcd410f 100644 --- a/src/main/org/apache/tools/ant/launch/Launcher.java +++ b/src/main/org/apache/tools/ant/launch/Launcher.java @@ -243,10 +243,17 @@ public class Launcher { URLClassLoader loader = new URLClassLoader(jars); Thread.currentThread().setContextClassLoader(loader); + Class mainClass = null; try { - Class mainClass = loader.loadClass(MAIN_CLASS); + mainClass = loader.loadClass(MAIN_CLASS); AntMain main = (AntMain) mainClass.newInstance(); main.startAnt(newArgs, null, null); + } catch (InstantiationException ex) { + System.out.println( + "Incompatible version of org.apache.tools.ant detected"); + File mainJar = Locator.getClassSource(mainClass); + System.out.println( + "Location of this class " + mainJar); } catch (Throwable t) { t.printStackTrace(); }