ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 28993] New: - [PATCH] Using <macrodef> can break XmlLogger
Date Fri, 14 May 2004 23:32:46 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28993>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28993

[PATCH] Using <macrodef> can break XmlLogger

           Summary: [PATCH] Using <macrodef> can break XmlLogger
           Product: Ant
           Version: 1.6.1
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: jglick@netbeans.org


In Ant 1.6.1 if you try to use XmlLogger on a build script that uses <macrodef>,
under some circumstances it will get confused about the stack and fail. See the
attached sample script and the result of running it with XmlLogger.

The problem is that MacroDef instances can change their hashCode during the
object's lifetime, which is verboten in Java; XmlLogger keeps a Hashtable and
maps the MacroDef to its build element in taskStarted, but by the time
taskFinished runs, the hashCode has changed and it can no longer find the same
task object.

Fix is simple enough: hardcode a hash for MacroDef's. Hopefully they are not
often used as hash keys so performance should not suffer much. Using
Object.hashCode is probably wrong since equals() is overridden.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message