The ProjectHelper2 [1] tries setting a reference to the project instance at line 925. But only for the placeholder UnkownElement. In line 951 that is replaced by the wrapper [2].
Conor had writte an article [3] about that whole scenario. Just an idea - implement: Project project; public void setProject(Project p) { project = p; } public void getProject() { return project; } public void log(String msg) { getProject().log(msg); } If I remember right, the reflection stuff during the initialization would set the reference then and you could log directly via the project instance. Jan [1] http://cvs.apache.org/viewcvs.cgi/ant/src/main/org/apache/tools/ant/helper/ProjectHelper2.java?view=annotate [2] http://cvs.apache.org/viewcvs.cgi/ant/src/main/org/apache/tools/ant/RuntimeConfigurable.java?view=annotate [3] http://codefeed.com/tutorial/ant_config.html >-----Ursprüngliche Nachricht----- >Von: Kev Jackson [mailto:[EMAIL PROTECTED] >Gesendet: Mittwoch, 24. August 2005 05:07 >An: Ant Developers List >Betreff: Re: AW: strange logging error > >[EMAIL PROTECTED] wrote: > >>Maybe the project is not set correctly. >>What does "getProject()" refer? >> >>If you inherit from DispatchUtils, you dont have a real task >(class inherited from oata.Task). >>You´re using a task wrapper instead. >> >> >>Jan >> >> >> >I know, but I was inheriting from Task (just indirectly). As >soon as I directly inherited from Task, the log worked. So: > >Task -> AbstractDarcs -> Initialize.execute (null pointer >exception) Task -> Initialize.execute (no problems) > >is this the correct behaviour for Ant? Should my initial >version have been using DispatchUtils? As I've programmed >round it and solved the problem I was having, it's not a >biggy, but I'm interested in why this is so. > >Kev > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] For >additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]