From 3a39ebed995578e9b6b14fb02724ddd2c4c3a516 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Tue, 10 Nov 2009 05:28:45 +0000 Subject: [PATCH] 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 --- CONTRIBUTORS | 1 + WHATSNEW | 4 ++++ contributors.xml | 4 ++++ .../tools/ant/taskdefs/optional/script/ScriptDef.java | 9 +-------- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index d7932b8b5..720327c80 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -334,6 +334,7 @@ Tom May Tomasz Bech Trejkaz Xaoza Ulrich Schmidt +Valentino Miazzo Victor Toni Vincent Legoll Waldek Herka diff --git a/WHATSNEW b/WHATSNEW index fb1e5bd72..e711a660d 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -526,6 +526,10 @@ Fixed bugs: compatibility to Ant 1.7.0. Bugzilla Report 48040. + * different task instances of the same ed tasks could + overwrite each others attributes/nested elements. + Bugzilla Report 41602. + Other changes: -------------- diff --git a/contributors.xml b/contributors.xml index d17d0b766..0dabc047d 100644 --- a/contributors.xml +++ b/contributors.xml @@ -1353,6 +1353,10 @@ Ulrich Schmidt + + Valentino + Miazzo + Victor Toni diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDef.java b/src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDef.java index 210ff21ed..62f1222c1 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDef.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDef.java @@ -50,11 +50,6 @@ public class ScriptDef extends DefBase { * script runner helper */ 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 */ private String name; @@ -203,9 +198,6 @@ public class ScriptDef extends DefBase { helper.setClassLoader(createLoader()); } - // Now create the scriptRunner - runner = helper.getScriptRunner(); - attributeSet = new HashSet(); for (Iterator i = attributes.iterator(); i.hasNext();) { Attribute attribute = (Attribute) i.next(); @@ -348,6 +340,7 @@ public class ScriptDef extends DefBase { * @param instance the script instance; can be null */ public void executeScript(Map attributes, Map elements, ScriptDefBase instance) { + ScriptRunnerBase runner = helper.getScriptRunner(); runner.addBean("attributes", attributes); runner.addBean("elements", elements); runner.addBean("project", getProject());