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: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to