ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 41368] Nested record tasks produces an empty output file
Date Wed, 05 Aug 2009 20:51:43 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=41368


Chung, Gene-Sung <genes_chung@hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |


--- Comment #5 from Chung, Gene-Sung <genes_chung@hotmail.com> 2009-08-05 13:51:40 PDT
---
This fix seems to cause some side effects which does not preserve the calling
hierarchical scoping for the record name while the original source code seems
to be intended to preserve it.

For instance, with this script:
    <target name="parent" depends="prepare">
        <record action="start" name="${parent.log}"/>
        <echo message="Parent target started"/>

        <antcall target="child">
            <param name="child.log" value="${recdir}/child-01.log"/>
        </antcall>

        <record action="stop" name="${parent.log}"/>
    </target>

    <target name="child">
        <record action="start" name="${child.log}"/>
        <echo message="Child target started - ${child.log}"/>
        <record action="stop" name="${parent.log}" append="yes"/>

        <echo message="Child target processing - ${child.log}"/>

        <record action="start" name="${parent.log}"/>
        <echo message="Child target ended - ${child.log}"/>
        <record action="stop" name="${child.log}"/>
    </target>

the fix generate the following log entries for parent:
     [echo] Parent target started

child:
     [echo] Child target started - recorder-out/child-01.log
     [echo] Child target processing - recorder-out/child-01.log (*)
     [echo] Child target ended - recorder-out/child-01.log
     [echo] Child target ended - recorder-out/child-01.log (*)

(*) seems to be errors.

Rather than the per-Project-object approach, it might be better to check the
project of RecorderEntry during the cleanup.

Recoder.java (Assuming all the changes were revoked)
  import java.util.Iterator;
  import java.util.Map;

    private void cleanup() {
        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);
    }

RecoderEntry.java
    public Project getProject() {
        return project;
    }

I have verified this with the ant scripts (record.xml and record2.xml) and the
above script.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Mime
View raw message