Author: gscokart
Date: Tue Aug 19 08:05:07 2008
New Revision: 687070
URL: http://svn.apache.org/viewvc?rev=687070&view=rev
Log:
fix very unlikely thread safety issue (may occur if PropertyHelperTask is used
in a parallel, which would be a strange use case)
Modified:
ant/core/trunk/src/main/org/apache/tools/ant/PropertyHelper.java
Modified: ant/core/trunk/src/main/org/apache/tools/ant/PropertyHelper.java
URL:
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/PropertyHelper.java?rev=687070&r1=687069&r2=687070&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/PropertyHelper.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/PropertyHelper.java Tue Aug 19
08:05:07 2008
@@ -177,7 +177,7 @@
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 @@
* @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;
}
/**