Browse Source

All instances of the same scriptdef task shared a single ScriptRunner, causing problems in multithreaded situations. Submitted by Valentino Miazzo. PR 41602

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@834354 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 15 years ago
parent
commit
3a39ebed99
4 changed files with 10 additions and 8 deletions
  1. +1
    -0
      CONTRIBUTORS
  2. +4
    -0
      WHATSNEW
  3. +4
    -0
      contributors.xml
  4. +1
    -8
      src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDef.java

+ 1
- 0
CONTRIBUTORS View File

@@ -334,6 +334,7 @@ Tom May
Tomasz Bech Tomasz Bech
Trejkaz Xaoza Trejkaz Xaoza
Ulrich Schmidt Ulrich Schmidt
Valentino Miazzo
Victor Toni Victor Toni
Vincent Legoll Vincent Legoll
Waldek Herka Waldek Herka


+ 4
- 0
WHATSNEW View File

@@ -526,6 +526,10 @@ Fixed bugs:
compatibility to Ant 1.7.0. compatibility to Ant 1.7.0.
Bugzilla Report 48040. Bugzilla Report 48040.


* different task instances of the same <scriptdef>ed tasks could
overwrite each others attributes/nested elements.
Bugzilla Report 41602.

Other changes: Other changes:
-------------- --------------




+ 4
- 0
contributors.xml View File

@@ -1353,6 +1353,10 @@
<first>Ulrich</first> <first>Ulrich</first>
<last>Schmidt</last> <last>Schmidt</last>
</name> </name>
<name>
<first>Valentino</first>
<last>Miazzo</last>
</name>
<name> <name>
<first>Victor</first> <first>Victor</first>
<last>Toni</last> <last>Toni</last>


+ 1
- 8
src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDef.java View File

@@ -50,11 +50,6 @@ public class ScriptDef extends DefBase {
* script runner helper * script runner helper
*/ */
private ScriptRunnerHelper helper = new ScriptRunnerHelper(); private ScriptRunnerHelper helper = new ScriptRunnerHelper();
/**
* script runner.
*/
/** Used to run the script */
private ScriptRunnerBase runner = null;


/** the name by which this script will be activated */ /** the name by which this script will be activated */
private String name; private String name;
@@ -203,9 +198,6 @@ public class ScriptDef extends DefBase {
helper.setClassLoader(createLoader()); helper.setClassLoader(createLoader());
} }


// Now create the scriptRunner
runner = helper.getScriptRunner();

attributeSet = new HashSet(); attributeSet = new HashSet();
for (Iterator i = attributes.iterator(); i.hasNext();) { for (Iterator i = attributes.iterator(); i.hasNext();) {
Attribute attribute = (Attribute) i.next(); Attribute attribute = (Attribute) i.next();
@@ -348,6 +340,7 @@ public class ScriptDef extends DefBase {
* @param instance the script instance; can be null * @param instance the script instance; can be null
*/ */
public void executeScript(Map attributes, Map elements, ScriptDefBase instance) { public void executeScript(Map attributes, Map elements, ScriptDefBase instance) {
ScriptRunnerBase runner = helper.getScriptRunner();
runner.addBean("attributes", attributes); runner.addBean("attributes", attributes);
runner.addBean("elements", elements); runner.addBean("elements", elements);
runner.addBean("project", getProject()); runner.addBean("project", getProject());


Loading…
Cancel
Save