ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r805382 - in /ant/core/trunk: ./ src/etc/testcases/taskdefs/ src/etc/testcases/taskdefs/recorder/ src/main/org/apache/tools/ant/taskdefs/
Date Tue, 18 Aug 2009 12:18:21 GMT
Author: bodewig
Date: Tue Aug 18 12:18:20 2009
New Revision: 805382

URL: http://svn.apache.org/viewvc?rev=805382&view=rev
Log:
improve nested-record patch.  PR 41368.  Submitted by Gene-Sung Chung

Modified:
    ant/core/trunk/CONTRIBUTORS
    ant/core/trunk/contributors.xml
    ant/core/trunk/src/etc/testcases/taskdefs/recorder/rectest5.result
    ant/core/trunk/src/etc/testcases/taskdefs/recorder/rectest6.result
    ant/core/trunk/src/etc/testcases/taskdefs/recorder2.xml
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Recorder.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java

Modified: ant/core/trunk/CONTRIBUTORS
URL: http://svn.apache.org/viewvc/ant/core/trunk/CONTRIBUTORS?rev=805382&r1=805381&r2=805382&view=diff
==============================================================================
Binary files - no diff available.

Modified: ant/core/trunk/contributors.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/contributors.xml?rev=805382&r1=805381&r2=805382&view=diff
==============================================================================
--- ant/core/trunk/contributors.xml (original)
+++ ant/core/trunk/contributors.xml Tue Aug 18 12:18:20 2009
@@ -435,6 +435,14 @@
     <last>Guliani</last>
   </name>
   <name>
+    <first>Gene-Sung</first>
+    <last>Chung</last>
+  </name>
+  <name>
+    <first>Georges-Etienne</first>
+    <last>Legendre</last>
+  </name>
+  <name>
     <first>Gero</first>
     <last>Vermaas</last>
   </name>

Modified: ant/core/trunk/src/etc/testcases/taskdefs/recorder/rectest5.result
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/etc/testcases/taskdefs/recorder/rectest5.result?rev=805382&r1=805381&r2=805382&view=diff
==============================================================================
--- ant/core/trunk/src/etc/testcases/taskdefs/recorder/rectest5.result (original)
+++ ant/core/trunk/src/etc/testcases/taskdefs/recorder/rectest5.result Tue Aug 18 12:18:20
2009
@@ -2,3 +2,4 @@
 
 test6:
      [echo] some message6
+     [echo] some message8

Modified: ant/core/trunk/src/etc/testcases/taskdefs/recorder/rectest6.result
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/etc/testcases/taskdefs/recorder/rectest6.result?rev=805382&r1=805381&r2=805382&view=diff
==============================================================================
--- ant/core/trunk/src/etc/testcases/taskdefs/recorder/rectest6.result (original)
+++ ant/core/trunk/src/etc/testcases/taskdefs/recorder/rectest6.result Tue Aug 18 12:18:20
2009
@@ -1 +1,3 @@
      [echo] some message6
+     [echo] some message7
+     [echo] some message8

Modified: ant/core/trunk/src/etc/testcases/taskdefs/recorder2.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/etc/testcases/taskdefs/recorder2.xml?rev=805382&r1=805381&r2=805382&view=diff
==============================================================================
--- ant/core/trunk/src/etc/testcases/taskdefs/recorder2.xml (original)
+++ ant/core/trunk/src/etc/testcases/taskdefs/recorder2.xml Tue Aug 18 12:18:20 2009
@@ -7,6 +7,10 @@
     <target name="test6">
         <record name="${recdir}/rectest6.log" action="start" />
         <echo message="some message6"/>
+        <record name="${recdir}/rectest5.log" action="stop" />
+        <echo message="some message7"/>
+        <record name="${recdir}/rectest5.log" action="start" />
+        <echo message="some message8"/>
         <record name="${recdir}/rectest6.log" action="stop" />
     </target>
 </project>

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Recorder.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Recorder.java?rev=805382&r1=805381&r2=805382&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Recorder.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Recorder.java Tue Aug 18 12:18:20
2009
@@ -18,6 +18,8 @@
 package org.apache.tools.ant.taskdefs;
 
 import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
 import org.apache.tools.ant.BuildEvent;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
@@ -64,7 +66,7 @@
     private int loglevel = -1;
     /** Strip task banners if true.  */
     private boolean emacsMode = false;
-    /** The recorder entries keyed by Project. Each value is another Hashtable of filename
to RecorderEntry. */
+    /** The list of recorder entries. */
     private static Hashtable recorderEntries = new Hashtable();
 
     //////////////////////////////////////////////////////////////////////
@@ -203,12 +205,7 @@
      */
     protected RecorderEntry getRecorder(String name, Project proj)
          throws BuildException {
-        Hashtable entries = (Hashtable) recorderEntries.get(proj);
-        if (null == entries) {
-            entries = new Hashtable();
-            recorderEntries.put(proj, entries);
-        }
-        Object o = entries.get(name);
+        Object o = recorderEntries.get(name);
         RecorderEntry entry;
 
         if (o == null) {
@@ -221,7 +218,7 @@
                 entry.openFile(append.booleanValue());
             }
             entry.setProject(proj);
-            entries.put(name, entry);
+            recorderEntries.put(name, entry);
         } else {
             entry = (RecorderEntry) o;
         }
@@ -311,10 +308,14 @@
      * @since Ant 1.7
      */
     private void cleanup() {
-        Hashtable entries = (Hashtable) recorderEntries.get(getProject());
-        if (null != entries) {
-            entries.clear();
-            recorderEntries.remove(entries);
+        Hashtable entries = (Hashtable) recorderEntries.clone();
+        Iterator itEntries = entries.entrySet().iterator();
+        while (itEntries.hasNext()) {
+            Map.Entry entry = (Map.Entry) itEntries.next();
+            RecorderEntry re = (RecorderEntry) entry.getValue();
+            if (re.getProject() == getProject()) {
+                recorderEntries.remove(entry.getKey());
+            }
         }
         getProject().removeBuildListener(this);
     }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java?rev=805382&r1=805381&r2=805382&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java Tue Aug 18 12:18:20
2009
@@ -299,6 +299,15 @@
     }
 
     /**
+     * Get the project associated with this recorder entry.
+     *
+     * @since 1.8.0
+     */
+    public Project getProject() {
+        return project;
+    }
+
+    /**
      * @since 1.6.2
      */
     public void cleanup() {



Mime
View raw message