[opencms-dev] nullpointer exception while using contentload on empty folder

Nigel Kersten nigel at cofa.unsw.edu.au
Thu Feb 23 23:05:58 CET 2006


On 24/02/2006, at 8:41 AM, Claus Priisholm wrote:

> But besides this, it is my understanding that one should use  
> <contentcheck> inside the loop to test some mandatory field in  
> order to determine if the list is empty or not. Haven't tried,  
> since I'm using the same approach as in the example. Which works  
> fine but unfortunately invokes a potentially expensive collector  
> twice... Well, that something for the cache to catch ...


The problem is that contentcheck checks for an element in the  
structured content, not whether the structured content exists or not.

ie, something this simple will cause an exception.

<cms:contentload "allInFolder" param="blahblahblah" editable="true">
	<cms:contentcheck ifexists="someElement">
	</cms:contentcheck>
</cms:contentload>

I don't mind checking outside the contentload for whether the folder  
is empty or not, even though I do think it should fail more  
gracefully than that, but I would like to be able to go:

<cms:contentload "allInFolder" param="blahblahblah" editable="true">
</cms:contentload>

for some empty folder, and have the collector simply produce a "New"  
button.

I'm browing through I_CmsResourceCollector at the moment, as it looks  
like that might have the solution, an alternative would also be to  
try and reverse engineer the parameters that should be passed to / 
system/workplace/editors/editor.jsp, but that seems less palatable.
-- 
Nigel Kersten [Senior Technical Officer]
College of Fine Arts, University of NSW, Australia.
CRICOS Provider Code: 00098G





More information about the opencms-dev mailing list