From 583cfae0e5473ffda8b3d45b750980b08550d995 Mon Sep 17 00:00:00 2001
From: Peter Reilly
Date: Thu, 5 Oct 2006 21:48:49 +0000
Subject: [PATCH] Do not set ant.file.{projectname} when the project name is
not set in the tag. (as discussed) Bugzilla report: 39920
git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@453401 13f79535-47bb-0310-9956-ffa450edef68
---
WHATSNEW | 3 +++
docs/manual/CoreTasks/import.html | 4 ++++
src/main/org/apache/tools/ant/helper/ProjectHelper2.java | 2 +-
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/WHATSNEW b/WHATSNEW
index 0c91e8e45..88f54d7a1 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -40,6 +40,9 @@ Fixed bugs:
* fix for junit4 issue introducted since beta2.
Bugzilla report 40682.
+* Error in duplicate project name with and .
+ Bugzilla report 39920.
+
Other changes:
--------------
diff --git a/docs/manual/CoreTasks/import.html b/docs/manual/CoreTasks/import.html
index 533eb0956..63ec92f61 100644
--- a/docs/manual/CoreTasks/import.html
+++ b/docs/manual/CoreTasks/import.html
@@ -79,6 +79,10 @@ property of the main buildfile.
Note that "builddocs" is not the filename, but the name attribute
present in the imported project tag.
+
+ If import file does not have a name attribute, the ant.file.projectname
+ property will not be set.
+
Resolving files against the imported file
diff --git a/src/main/org/apache/tools/ant/helper/ProjectHelper2.java b/src/main/org/apache/tools/ant/helper/ProjectHelper2.java
index 78fa690fc..0450bf25f 100644
--- a/src/main/org/apache/tools/ant/helper/ProjectHelper2.java
+++ b/src/main/org/apache/tools/ant/helper/ProjectHelper2.java
@@ -738,7 +738,7 @@ public class ProjectHelper2 extends ProjectHelper {
}
}
- if (context.getBuildFile() != null) {
+ if (context.getBuildFile() != null && nameAttributeSet) {
project.setUserProperty("ant.file."
+ context.getCurrentProjectName(),
context.getBuildFile().toString());