Author: mbenson Date: Thu Jan 11 11:21:54 2007 New Revision: 495340 URL: http://svn.apache.org/viewvc?view=rev&rev=495340 Log: Synchonization issues in PropertyHelper. Bugzilla 41353. Modified: ant/core/trunk/WHATSNEW ant/core/trunk/src/main/org/apache/tools/ant/PropertyHelper.java Modified: ant/core/trunk/WHATSNEW URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?view=diff&rev=495340&r1=495339&r2=495340 ============================================================================== --- ant/core/trunk/WHATSNEW (original) +++ ant/core/trunk/WHATSNEW Thu Jan 11 11:21:54 2007 @@ -36,7 +36,9 @@ * Strip out all -J arguments to non forking rmic adapters, specifically the Sun and Weblogic compilers. - Bug report 41349 + Bug report 41349 + +* Synchonization issues in PropertyHelper. Bugzilla 41353. Other changes: -------------- 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?view=diff&rev=495340&r1=495339&r2=495340 ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/PropertyHelper.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/PropertyHelper.java Thu Jan 11 11:21:54 2007 @@ -470,7 +470,10 @@ * (including user properties). */ public Hashtable getProperties() { - return new Hashtable(properties); + //avoid concurrent modification: + synchronized (properties) { + return new Hashtable(properties); + } // There is a better way to save the context. This shouldn't // delegate to next, it's for backward compatibility only. } @@ -480,7 +483,10 @@ * @return a hashtable containing just the user properties */ public Hashtable getUserProperties() { - return new Hashtable(userProperties); + //avoid concurrent modification: + synchronized (userProperties) { + return new Hashtable(userProperties); + } } /** @@ -526,14 +532,17 @@ * @since Ant 1.6 */ public void copyInheritedProperties(Project other) { - Enumeration e = inheritedProperties.keys(); - while (e.hasMoreElements()) { - String arg = e.nextElement().toString(); - if (other.getUserProperty(arg) != null) { - continue; + //avoid concurrent modification: + synchronized (inheritedProperties) { + Enumeration e = inheritedProperties.keys(); + while (e.hasMoreElements()) { + String arg = e.nextElement().toString(); + if (other.getUserProperty(arg) != null) { + continue; + } + Object value = inheritedProperties.get(arg); + other.setInheritedProperty(arg, value.toString()); } - Object value = inheritedProperties.get(arg); - other.setInheritedProperty(arg, value.toString()); } } @@ -550,14 +559,17 @@ * @since Ant 1.6 */ public void copyUserProperties(Project other) { - Enumeration e = userProperties.keys(); - while (e.hasMoreElements()) { - Object arg = e.nextElement(); - if (inheritedProperties.containsKey(arg)) { - continue; + //avoid concurrent modification: + synchronized (userProperties) { + Enumeration e = userProperties.keys(); + while (e.hasMoreElements()) { + Object arg = e.nextElement(); + if (inheritedProperties.containsKey(arg)) { + continue; + } + Object value = userProperties.get(arg); + other.setUserProperty(arg.toString(), value.toString()); } - Object value = userProperties.get(arg); - other.setUserProperty(arg.toString(), value.toString()); } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org