NPE being thrown when using dynamic attributes in stripes layout-render tags with Freemarker templates

Geoff Shuetrim <[email protected]>
Newsgroups gmane.comp.web.freemarker.user,gmane.comp.java.stripes.user
Message-ID <CAB13hhbh3Fs0JrcCX1i66_4jWgkSOnHPn4qR=Kph5fFOCHEVDg@mail.gmail.com>
Only when using Freemarker templates instead of JSP pages, I am running
into an NPE exception that is raised when I use dynamic attributes on
Stripes layout-render tags.  The stack trace indicates:

Caused by: java.lang.NullPointerException
	at net.sourceforge.stripes.tag.layout.LayoutRenderTag.setDynamicAttribute(LayoutRenderTag.java:101)

The problem is that the context property of the LayoutRenderTag class is
not initialized before the call is made to the setDynamicAttribute(String,
String, Object) method.  I can hack together a fix for this by calling the
initialize() method of the LayoutRenderTag class whenever the context is
found to be null at the start of the setDynamicAttribute(String, String,
Object) method.  That works but it makes me nervous.  I am not clear on why
the setName method of the LayoutRenderTag class is not being called first
and I am not confident that the initialization will always work when
required.

This has only become a problem for me since exploring the implications of
migrating to Stripes 1.3.7 and Freemarker 2.3.19 from Stripes 1.3.6 and
Freemarker 2.3.17.

Regards

Geoff Shuetrim

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

_______________________________________________
FreeMarker-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.