ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt_Con...@i2.com
Subject RE: Custom Task breaks in Ant 1.4
Date Fri, 28 Sep 2001 16:55:40 GMT
I had the same problem - turns out my custom task has a nested element 
which was a subclass of the ant builtin type Task (I had nested Property 
types).  In my custom type's createXXX I was constructing this object, but 
not calling setProject(project) on it.  I guess in 1.3, the Task 
initialization code did not use the project member variable, but it does 
now, and thus the reason why it worked in 1.3 and not 1.4


Matt




I'm getting the following exception when trying to run my custom task.
The actual error is a NullPointerException with a Project instance.
It works in Ant 1.3, so I suspect my task either isn't complient, or 
I've found a bug.  More info that may help is that I'm using a couple 
nested classes in my custom task, but only referring to their parent 
class in my <taskdef> entry.

Piece of build.xml in question:
---------------------------------------------------------
     <translationcheck logfile="build/TranslationCheck-AllFiles.log" 
reportfor="entireset">
       <keyset>
         <fileset dir="resources/translations"
 
includes="base.properties,lang1.properties,mtg1.properties" />
       </keyset>
       <searchset>
         <fileset dir="web/user" includes="**/*.jsp" />
         <fileset dir="source" includes="**/*.java" />
         <ignore key="revision.mtg" />
         <ignore key="revision.lang" />
         <ignore key="revision.base" />
         <ignore key="jsp.httperrorpage.errormsg.404" />
       </searchset>
     </translationcheck>
----------------------------------------------------------


Small piece of my custom task: (I think it's my code's point of entry 
into Ant)
------------------------------------------------------------------------
     FileSet fs = (FileSet)filesets.get(i);
     DirectoryScanner ds = fs.getDirectoryScanner(project);
----------------------------------------------------------



Part of Ant output with debug turned on:
------------------------------------------------------------------------
    +Task: translationcheck
Finding class com.katun.kolc.ant.TranslationCheck$SearchSet
Class com.katun.kolc.ant.TranslationCheck$SearchSet loaded from ant loader
Finding class com.katun.kolc.ant.TranslationCheck$KeySet
Class com.katun.kolc.ant.TranslationCheck$KeySet loaded from ant loader
Class java.lang.String loaded from parent loader
Class java.util.List loaded from parent loader
Class java.util.ArrayList loaded from parent loader
Class org.apache.tools.ant.types.FileSet loaded from parent loader

BUILD FAILED

java.lang.NullPointerException
         at 
org.apache.tools.ant.ProjectHelper.configure(ProjectHelper.java:651)
         at 
org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfig
urable.java:143)
         at org.apache.tools.ant.Task.maybeConfigure(Task.java:178)
         at 
org.apache.tools.ant.UnknownElement.handleChildren(UnknownElement.jav
a:139)
         at 
org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.jav
a:88)
         at org.apache.tools.ant.Task.perform(Task.java:216)
         at org.apache.tools.ant.Target.execute(Target.java:164)
         at org.apache.tools.ant.Target.performTasks(Target.java:182)
         at org.apache.tools.ant.Project.executeTarget(Project.java:601)
         at org.apache.tools.ant.Project.executeTargets(Project.java:560)
         at org.apache.tools.ant.Main.runBuild(Main.java:454)
         at org.apache.tools.ant.Main.start(Main.java:153)
         at org.apache.tools.ant.Main.main(Main.java:176)
--------------------------------------------------------

Thanks in advance for any help,
Dan
dan@dantanner.com


Mime
View raw message