Browse Source

fix very unlikely thread safety issue (may occur if PropertyHelperTask is used in a parallel, which would be a strange use case)

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@687070 13f79535-47bb-0310-9956-ffa450edef68
master
Scokart Gilles 17 years ago
parent
commit
1c7138c4df
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      src/main/org/apache/tools/ant/PropertyHelper.java

+ 4
- 3
src/main/org/apache/tools/ant/PropertyHelper.java View File

@@ -177,7 +177,7 @@ public class PropertyHelper implements GetProperty {

private Project project;
private PropertyHelper next;
private Hashtable delegates = new Hashtable();
private volatile Hashtable delegates = new Hashtable();

/** Project properties map (usually String to String). */
private Hashtable properties = new Hashtable();
@@ -949,8 +949,9 @@ public class PropertyHelper implements GetProperty {
* @since Ant 1.8
*/
protected List getDelegates(Class type) {
return delegates.containsKey(type)
? (List) new ArrayList((List) delegates.get(type)) : Collections.EMPTY_LIST;
Hashtable curDelegates = delegates;
return curDelegates.containsKey(type)
? (List) new ArrayList((List) curDelegates.get(type)) : Collections.EMPTY_LIST;
}

/**


Loading…
Cancel
Save