ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject Re: NullPointerException when adding listener
Date Thu, 21 Jul 2005 18:42:15 GMT
Looks like your XmlLogger object needs -some-
configuration between instantiation and addition as a
listener.

HTH,
Matt

--- Juergen Hermann <jh@web.de> wrote:

> Hi, the following build script which adds a listener
> at runtime fails with a 
> NullPointerExcepton. Is this a bug, just not
> possible or an error in my 
> script? (Tested with ant 1.6.2)
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <project name="logger.test" default="test"
> basedir=".">
>     <description>
>         Test Adding Logger via Scripting
>     </description>
> 
>     <target name="test">
>         <property name="XmlLogger.file"
>             location="ant.log.xml"/>
>         <scriptdef name="add-xml-logger"
> language="jython"><![CDATA[if 1:
>             from org.apache.tools.ant import
> XmlLogger
>             listener = XmlLogger()
>             project.addBuildListener(listener)
>             ]]>
>         </scriptdef>
>         <add-xml-logger/>
>     </target>
> </project>
> 
> 
> Adding reference: org.apache.ant.scriptrepo
>  +Datatype add-xml-logger 
>
org.apache.tools.ant.taskdefs.optional.script.ScriptDefBase
> 
> BUILD FAILED
> java.lang.RuntimeException: Unknown task
> org.apache.tools.ant.UnknownElement@
> 161ce13 not in {}
>         at
>
org.apache.tools.ant.XmlLogger.taskFinished(XmlLogger.java:336)
>         at
>
org.apache.tools.ant.Project.fireTaskFinished(Project.java:1909)
>         at
> org.apache.tools.ant.Task.perform(Task.java:380)
>         at
> org.apache.tools.ant.Target.execute(Target.java:341)
>         at
>
org.apache.tools.ant.Target.performTasks(Target.java:369)
>         at
>
org.apache.tools.ant.Project.executeTarget(Project.java:1214)
>         at
>
org.apache.tools.ant.Project.executeTargets(Project.java:1062)
>         at
> org.apache.tools.ant.Main.runBuild(Main.java:673)
>         at
> org.apache.tools.ant.Main.startAnt(Main.java:188)
>         at
>
org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
>         at
>
org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
> 
> Total time: 1 second
> java.lang.NullPointerException
>         at
>
org.apache.tools.ant.XmlLogger$TimedElement.access$100
> (XmlLogger.java:111)
>         at
>
org.apache.tools.ant.XmlLogger.buildFinished(XmlLogger.java:150)
>         at
>
org.apache.tools.ant.Project.fireBuildFinished(Project.java:1796)
>         at
> org.apache.tools.ant.Main.runBuild(Main.java:693)
>         at
> org.apache.tools.ant.Main.startAnt(Main.java:188)
>         at
>
org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
>         at
>
org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
> 
> Ciao, J├╝rgen
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Mime
View raw message