ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Ant.java
Date Wed, 10 Sep 2003 13:17:00 GMT
bodewig     2003/09/10 06:17:00

  Modified:    src/main/org/apache/tools/ant/taskdefs Ant.java
  Log:
  It is legal to omit the target attribute in <ant>, don't die with a NPE
  
  Revision  Changes    Path
  1.88      +17 -10    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.87
  retrieving revision 1.88
  diff -u -r1.87 -r1.88
  --- Ant.java	4 Sep 2003 11:46:03 -0000	1.87
  +++ Ant.java	10 Sep 2003 13:17:00 -0000	1.88
  @@ -365,9 +365,7 @@
                   .equals(getProject().getProperty("ant.file"))
                   && getOwningTarget() != null) {
   
  -                String owningTargetName = getOwningTarget().getName();
  -
  -                if (owningTargetName.equals("")) {
  +                if (getOwningTarget().getName().equals("")) {
                       if (getTaskName().equals("antcall")) {
                           throw new BuildException("antcall must not be used at"
                                                    + " the top level.");
  @@ -376,7 +374,22 @@
                                                    + " top level must not invoke"
                                                    + " its own build file.");
                       }
  -                } else if (owningTargetName.equals(target)) {
  +                }
  +            }
  +
  +            ProjectHelper.configureProject(newProject, new File(antFile));
  +
  +            if (target == null) {
  +                target = newProject.getDefaultTarget();
  +            }
  +
  +            if (newProject.getProperty("ant.file")
  +                .equals(getProject().getProperty("ant.file"))
  +                && getOwningTarget() != null) {
  +
  +                String owningTargetName = getOwningTarget().getName();
  +
  +                if (owningTargetName.equals(target)) {
                       throw new BuildException(getTaskName() + " task calling "
                                                + "its own parent target.");
                   } else {
  @@ -391,12 +404,6 @@
                                                    + "\'.");
                       }
                   }
  -            }
  -
  -            ProjectHelper.configureProject(newProject, new File(antFile));
  -
  -            if (target == null) {
  -                target = newProject.getDefaultTarget();
               }
   
               addReferences();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message