Joshua Levy wrote:
> 
> Here is the NullPointerException/bad error message.
> Take a look at the velocity.err1.log file.  Notice that
> the last error message on the stack is not the right one.
> (And if you're on a UNIX machine, and use "tail velocity.log",
> you wont even see the real error, because it is too far
> up.  The template which caused this is HorseForm.err1.vm.
> I've included HorseWithForm.java for you to look at,
> but you will not be able to run it without some more
> files.

What exactly is the complaint here?  I looked at the included log file,
and it's throwing a Parser Exception because of the references.  I think
we've been through this before.  You can't lead a reference off with a
number, and the '+' isn't allowed either, if I recall.

Now, I will agree that it should just consider it to be just text, but
that's not what you want anyway :)

So what I assume is happening is that your template isn't being parsed,
and therefore the variable template is null.

So in Form.trans(), you are calling Velocity.evaluate with a null
pointer as the input string, as you didn't set that either.

I will go fix Velocity.evaluate() so it throws a smarter exception,
telling you what's wrong, but you will have to fix your template either
way.

geir


> D:\Joshua\rpg\gmht\examples\horses>java HorseWithForm
> Velocity.evaluate failed
> java.lang.NullPointerException
>         at org.apache.velocity.app.Velocity.evaluate(Velocity.java:177)
>         at Form.trans(Form.java:90)
>         at HorseWithForm.main(HorseWithForm.java:19)
> 
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail.
> http://personal.mail.yahoo.com/
> 
>   ------------------------------------------------------------------------
>                            Name: velocity.err1.log
>    velocity.err1.log       Type: unspecified type (application/octet-stream)
>                        Encoding: base64
>                     Description: velocity.err1.log
> 
>   ------------------------------------------------------------------------
> Name: $name  Breed: $breed<BR>
> Height: ${2d2+15}hh  Age: ${1d4}y<BR>
> Color: $color  Face: $face<BR>
> 
>   ------------------------------------------------------------------------
>                             Name: HorseWithForm.java
>    HorseWithForm.java       Type: X-unknown/attachment
>                         Encoding: base64
>                      Description: HorseWithForm.java

-- 
Geir Magnusson Jr.                               [EMAIL PROTECTED]
Developing for the web?  See http://jakarta.apache.org/velocity/

Reply via email to