Browse Source

Make sure <buildnumber> doesn't break property immutability rules,

make it reset the file attribute at the end of execute (bug 7552
audit).


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272342 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 23 years ago
parent
commit
7db8bf5f95
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      src/main/org/apache/tools/ant/taskdefs/BuildNumber.java

+ 5
- 2
src/main/org/apache/tools/ant/taskdefs/BuildNumber.java View File

@@ -72,6 +72,7 @@ import org.apache.tools.ant.util.FileUtils;
* *
* @author <a href="mailto:peter@apache.org">Peter Donald</a> * @author <a href="mailto:peter@apache.org">Peter Donald</a>
* @version $Revision$ $Date$ * @version $Revision$ $Date$
* @since Ant 1.5
* @ant.task name="buildnumber" * @ant.task name="buildnumber"
*/ */
public class BuildNumber public class BuildNumber
@@ -111,6 +112,7 @@ public class BuildNumber
public void execute() public void execute()
throws BuildException throws BuildException
{ {
File savedFile = m_file; // may be altered in validate
validate(); validate();


final Properties properties = loadProperties(); final Properties properties = loadProperties();
@@ -145,11 +147,12 @@ public class BuildNumber
{ {
} }
} }
m_file = savedFile;
} }


//Finally set the property //Finally set the property
getProject().setProperty( DEFAULT_PROPERTY_NAME,
String.valueOf( buildNumber ) );
getProject().setNewProperty( DEFAULT_PROPERTY_NAME,
String.valueOf( buildNumber ) );
} }


/** /**


Loading…
Cancel
Save