Browse Source

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
master
Peter Reilly 20 years ago
parent
commit
d50c8c978b
2 changed files with 9 additions and 1 deletions
  1. +1
    -0
      WHATSNEW
  2. +8
    -1
      src/main/org/apache/tools/ant/launch/Launcher.java

+ 1
- 0
WHATSNEW View File

@@ -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
===================================


+ 8
- 1
src/main/org/apache/tools/ant/launch/Launcher.java View File

@@ -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();
}


Loading…
Cancel
Save