bodewig     2004/04/08 07:58:19

  Modified:    src/main/org/apache/tools/ant/taskdefs Ant.java
  Log:
  Don't die if the ant.file property hasn't been set.
  
  Jelly's Ant tag library currently doesn't set this property and each
  <ant> task used in Jelly will result in an NPE otherwise.
  
  Revision  Changes    Path
  1.100     +5 -3      ant/src/main/org/apache/tools/ant/taskdefs/Ant.java
  
  Index: Ant.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Ant.java,v
  retrieving revision 1.99
  retrieving revision 1.100
  diff -u -r1.99 -r1.100
  --- Ant.java  9 Mar 2004 16:48:03 -0000       1.99
  +++ Ant.java  8 Apr 2004 14:58:19 -0000       1.100
  @@ -321,11 +321,13 @@
                       + " in build file " +  antFile, Project.MSG_VERBOSE);
               newProject.setUserProperty("ant.file" , antFile);
   
  +            String thisAntFile = getProject().getProperty("ant.file");
               // Are we trying to call the target in which we are defined (or
               // the build file if this is a top level task)?
  -            if (newProject.resolveFile(newProject.getProperty("ant.file"))
  -                .equals(getProject().resolveFile(getProject()
  -                .getProperty("ant.file"))) && getOwningTarget() != null) {
  +            if (thisAntFile != null
  +                && newProject.resolveFile(newProject.getProperty("ant.file"))
  +                .equals(getProject().resolveFile(thisAntFile)) 
  +                && getOwningTarget() != null) {
   
                   if (getOwningTarget().getName().equals("")) {
                       if (getTaskName().equals("antcall")) {
  
  
  

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

Reply via email to