velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Will Glass-Husain" <wgl...@forio.com>
Subject Re: Documentation vs. code issue
Date Wed, 06 Jul 2005 22:43:00 GMT
PS.  See this code block for an example.

http://jakarta.apache.org/velocity/developer-guide.html#How%20Velocity%20Works

----- Original Message ----- 
From: "Tuomas Rinta" <tuomas@web-effect.net>
To: <velocity-user@jakarta.apache.org>
Sent: Wednesday, July 06, 2005 3:21 PM
Subject: Documentation vs. code issue


> Hi all,
>
> After posting this to the wrong mailing list (oh, the humiliation), I'm 
> gonna try again if I get it right this time :)
>
> I decided to pick Velocity for a project I am doing and ran into a small 
> issue with the Javadoc. When using the code example from the Javadoc of 
> org.apache.velocity.Template I get an NullPointerException when executing 
> the code, the code is:
>
>  Template template = Velocity.getTemplate("test.vm");
>  Context context = new VelocityContext();
>  template.merge(context, writer);
>
> (Copied directly from the Javadoc, just omitting the context.put-methods)
>
> After some source-browsing, I noticed that when the Template is loaded via 
> Velocity.getTemplate, the ResourceManager-instance used by the 
> RuntimeSingleton-class is never initialized, causing the 
> NullPointerException. I quickly tried to call .init() on the 
> RuntimeSingleton in org.apache.velocity.app.Velocity and it fixed the 
> problem. I am using the latest stable version for the website (1.4) and 
> the org/apache/velocity/app/Velocity.java-file has the following CVS 
> version id:
>
> $Id: Velocity.java, v1.30.4.1 2004/03/03 23:22:53 geirm Exp $
>
> Here's the World's Smallest Diff(tm) that fixes the problem in 
> Velocity.java:
>
> trinta@takeshi app $ diff Velocity.java Velocity.java.fix
> 468a469
> >       RuntimeSingleton.init();
>
> I don't know if this has been reported yet but couldn't find any reference 
> to it with Google. If this is a) a known issue b) the wrong list c) My Own 
> Fault Cause I Don't Know What I'm Doing(tm), just ignore this message ;)
>
> Cheers,
> Tuomas Rinta
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 


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


Mime
View raw message