Browse Source

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.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276290 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 21 years ago
parent
commit
89ab1168c9
1 changed files with 5 additions and 3 deletions
  1. +5
    -3
      src/main/org/apache/tools/ant/taskdefs/Ant.java

+ 5
- 3
src/main/org/apache/tools/ant/taskdefs/Ant.java View File

@@ -321,11 +321,13 @@ public class Ant extends Task {
+ " 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")) {


Loading…
Cancel
Save