Many thanks to both Ara and Matthew. Your quick and accurate replies were
most appreciated!
Using the <XDoclet:forAllClasses> worked great. I tried using {0} in the
destination file instead and all I got was a file with "{0}" in its name -
so is this feature a post-1.0.1 feature? I'm sticking with 1.0.1 for the
time being as I have plenty of other variables in my equation and I'm trying
to minimize them as much as possible.
In my particular case, the forAllClasses is the approach I need, but I'm
curious why the {0} doesn't work. I'm also assuming the "XDt" prefix for
tags is post-1.0.1, right?
Thanks again,
Erik
----- Original Message -----
From: "Ara Abrahamian" <[EMAIL PROTECTED]>
To: "'Erik Hatcher'" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Friday, January 04, 2002 3:59 AM
Subject: RE: [Xdoclet-user] NullPointerException <template> - help!
> There should be a problem in your template file. It throws NPE because
> getCurrentClass() in className() return null, in other words you want to
> get the current class name but no current class is set. You should use
> template tags which set it and iterate over classes
> (XDtClass:forAllClasses for example).
>
> Basically templates are run in two modes: per-class and for-all. You
> designate per-class mode by simply adding a {0} in destinationFile, and
> xdoclet will substitute it with the class name. In for-all mode,
> template is run for all specified classes matching the criteria
> (deriving from x, having tag y, etc), so you have to do a forAllClasses
> and then move on to work on each class and generate an output file based
> on those classes.
>
> Ara.
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:xdoclet-user-
> > [EMAIL PROTECTED]] On Behalf Of Erik Hatcher
> > Sent: Friday, January 04, 2002 4:46 AM
> > To: [EMAIL PROTECTED]
> > Subject: [Xdoclet-user] NullPointerException <template> - help!
> >
> > I'm using this build.xml piece:
> >
> > <xdoclet sourcepath="${src.dir}"
> > destdir="${build.dir}"
> > classpathref="xdoclet.classpath">
> > <fileset dir="${src.dir}">
> > <include name="**/*.java" />
> > </fileset>
> > <template templateFile="temp.template"
> > destinationfile="temp.properties"></template>
> > </xdoclet>
> >
> > [xdoclet] (TemplateEngine.invokeMethod 524 ) Invoking method
> > failed:
> > lassName , line=1 of template file: C:\test\temp.template
> > [xdoclet] java.lang.NullPointerException
> > [xdoclet] at xdoclet.SubTask.className(SubTask.java:576)
> > [xdoclet] at java.lang.reflect.Method.invoke(Native Method)
> > [xdoclet] at
> > xdoclet.util.TemplateEngine.invokeMethod(TemplateEngine.java
> > 520)
> > [xdoclet] at
> > xdoclet.util.TemplateEngine.invokeContentMethod(TemplateEngi
> > e.java:627)
> > [xdoclet] at
> > xdoclet.util.TemplateEngine.generate(TemplateEngine.java:428
> >
> > [xdoclet] at
> > xdoclet.SubTask.generateFileUsingTemplate(SubTask.java:3052)
> > [xdoclet] at
> > xdoclet.TemplateSubTask.execute(TemplateSubTask.java:33)
> > [xdoclet] at
> > xdoclet.DocletTask$DocletMain.start(DocletTask.java:284)
> > [xdoclet] at java.lang.reflect.Method.invoke(Native Method)
> > [xdoclet] at
> > com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.jav
> >
> > I've tried this with both Ant 1.4.1 and the latest (from CVS) version
> and
> > get the same error.
> >
> > I'm using XDoclet 1.0.1 release version.
> >
> > Any help is greatly appreciated.
> >
> > Thanks,
> > Erik
> >
> >
> >
> >
> > _______________________________________________
> > Xdoclet-user mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/xdoclet-user
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
_______________________________________________
Xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user