You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Tuomas Rinta <tu...@web-effect.net> on 2005/07/07 00:08:41 UTC
Documentation vs. code issue
Hi all,
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: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
Re: Documentation vs. code issue
Posted by Tuomas Rinta <tu...@web-effect.net>.
Tuomas Rinta wrote:
> 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 ;)
And I _did_ mean to send this to the velocity-dev-list... Sorry ;)
Cheers,
Tuomas Rinta
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org