peterreilly    2005/05/20 09:44:56

  Modified:    .        WHATSNEW
               src/main/org/apache/tools/ant/launch Launcher.java
  Log:
  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.
  
  Revision  Changes    Path
  1.827     +1 -0      ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.826
  retrieving revision 1.827
  diff -u -r1.826 -r1.827
  --- WHATSNEW  20 May 2005 16:34:07 -0000      1.826
  +++ WHATSNEW  20 May 2005 16:44:56 -0000      1.827
  @@ -211,6 +211,7 @@
     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
   ===================================
  
  
  
  1.30      +8 -1      ant/src/main/org/apache/tools/ant/launch/Launcher.java
  
  Index: Launcher.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/launch/Launcher.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- Launcher.java     1 Mar 2005 14:55:47 -0000       1.29
  +++ Launcher.java     20 May 2005 16:44:56 -0000      1.30
  @@ -243,10 +243,17 @@
   
           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();
           }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to