From dev-return-77838-apmail-ant-dev-archive=ant.apache.org@ant.apache.org Thu Jan 11 19:22:59 2007 Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 3968 invoked from network); 11 Jan 2007 19:22:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Jan 2007 19:22:58 -0000 Received: (qmail 7786 invoked by uid 500); 11 Jan 2007 19:23:03 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 7757 invoked by uid 500); 11 Jan 2007 19:23:03 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 7742 invoked by uid 500); 11 Jan 2007 19:23:03 -0000 Received: (qmail 7738 invoked by uid 99); 11 Jan 2007 19:23:03 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Jan 2007 11:23:03 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Jan 2007 11:22:55 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 3DA6F1A981A; Thu, 11 Jan 2007 11:21:55 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r495340 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/PropertyHelper.java Date: Thu, 11 Jan 2007 19:21:55 -0000 To: ant-cvs@apache.org From: mbenson@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070111192155.3DA6F1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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