Jos Snellings schrieb:
Dear,
Just a small question, testing:
When I get:
java.lang.NullPointerException
at
org.apache.cocoon.stringtemplate.StringTemplateGenerator.constructCacheKey(StringTemplateGenerator.java:75)
I notice that StringTemplateGenerator has two constructors: one with a
'source' argument, and one without.
The one without source argument is called.
Does this make sense? Am I making a mistake in the sitemap?
Here's the code:
<map:match pattern="testcases/{name}.st">
<map:generate src="testcases/{map:name}.st"
type="string-template"/>
<map:serialize type="xhtml"/>
</map:match>
Hi,
the two constructors serve two different purposes:
* the default contructor is used by the sitemap to assemble pipelines in
the way described by the sitemap definition (so that one being called is
expected in your case)
* the constructor with the source parameter is intended for the
programmatic use (pure convenience)
Looking at the code in the StringTemplateGenerator suggests that the
source you're passing "testcases/{map:name}.st" cannot be resolved for
the "name" you are using, thus resolving in the URL being null and
causing a NPE.
URL resolution in your case (using a sitemap) is performed by the
GenerateNode, which delegates back to the Invocation(Impl).
No logging in that area *sigh* so you will either need to double check
your "name" parameter and resources and/or go debugging...
The sitemap fragment you posted is perfectly fine BTW.
hth,
Steven
Thanks,
Jos