peterreilly 2003/12/23 07:47:51
Modified: src/main/org/apache/tools/ant/taskdefs/optional Script.java
Log:
Fix for script memory retaining problem.
PR: 25394
Obtained from: Jose Alberto Fernandez / Antoine Levy-Lambert
Revision Changes Path
1.25 +18 -6
ant/src/main/org/apache/tools/ant/taskdefs/optional/Script.java
Index: Script.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/Script.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- Script.java 17 Sep 2003 20:11:43 -0000 1.24
+++ Script.java 23 Dec 2003 15:47:51 -0000 1.25
@@ -65,15 +65,28 @@
* @author Sam Ruby <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>
*/
public class Script extends Task {
- /** Used to run the script */
- private ScriptRunner runner = new ScriptRunner();
+ private String language;
+ private File src;
+ private String text;
+
/**
* Do the work.
*
* @exception BuildException if something goes wrong with the build
*/
public void execute() throws BuildException {
+ ScriptRunner runner = new ScriptRunner();
+ if (language != null) {
+ runner.setLanguage(language);
+ }
+ if (src != null) {
+ runner.setSrc(src);
+ }
+ if (text != null) {
+ runner.addText(text);
+ }
+
runner.addBeans(getProject().getProperties());
runner.addBeans(getProject().getUserProperties());
runner.addBeans(getProject().getTargets());
@@ -91,7 +104,7 @@
* @param language the scripting language name for the script.
*/
public void setLanguage(String language) {
- runner.setLanguage(language);
+ this.language = language;
}
/**
@@ -100,8 +113,7 @@
* @param fileName the name of the file containing the script source.
*/
public void setSrc(String fileName) {
- File file = new File(fileName);
- runner.setSrc(file);
+ this.src = new File(fileName);
}
/**
@@ -110,6 +122,6 @@
* @param text a component of the script text to be added.
*/
public void addText(String text) {
- runner.addText(text);
+ this.text = text;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]