ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: Peformance Task usage from custom task
Date Thu, 03 Sep 2009 04:59:50 GMT
According to your stacktrace the NPE occurs in line 62 of the listener
Its source is available here:
http://ant-contrib.svn.sourceforge.net/viewvc/ant-contrib/ant-contrib/trunk/src/main/java/net/sf/antcontrib/perf/AntPerformanceListener.java?revision=130&view=markup

	long stop_time = master.stop();

So 'master' is null.
This field is initialized in the buildStarted() method, which is invoked before your task
started.

So try instead your add

AntPerformanceListener perf = new net.sf.antcontrib.perf.AntPerformanceListener();
perf.buildStarted(null); // the BuildEvent is not evaluated in that method
getProject().addBuildListener(perf);


Jan


>-----Urspr√ľngliche Nachricht-----
>Von: Raja Nagendra Kumar [mailto:Nagendra.Raja@tejasoft.com] 
>Gesendet: Mittwoch, 2. September 2009 20:37
>An: dev@ant.apache.org
>Betreff: Re: Peformance Task usage from custom task
>
>
>Hi Dale,
>
>Thank you for the pointer.
>
>Tried this in custom ant ask	    getProject().addBuildListener(new
>net.sf.antcontrib.perf.AntPerformanceListener());
>
>this at the end of the build give the below exception..
>
>java.lang.NullPointerException
>        at
>net.sf.antcontrib.perf.AntPerformanceListener.buildFinished(AntPerfor
>manceListener.java:62)
>        at 
>org.apache.tools.ant.Project.fireBuildFinished(Project.java:2037)
>        at org.apache.tools.ant.Main.runBuild(Main.java:778)
>        at org.apache.tools.ant.Main.startAnt(Main.java:217)
>        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
>        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
>
>Not sure what else needs to be added..
>
>
>Dale Anson wrote:
>> 
>> From a custom task, you have access to a Project object, which has
>> both add and remove build listener methods, which means you should be
>> able to add and remove listeners on the fly.   I haven't tried this,
>> but I don't see why it wouldn't work.
>> 
>> Dale
>> 
>
>-- 
>View this message in context: 
>http://www.nabble.com/Peformance-Task-usage-from-custom-task-tp
25260860p25263224.html
>Sent from the Ant - Dev mailing list archive at Nabble.com.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
>For additional commands, e-mail: dev-help@ant.apache.org
>
>

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


Mime
View raw message