Vadim Gritsenko pisze: > Joerg Heinicke wrote: >> On 19.09.2007 18:22 Uhr, Grzegorz Kossakowski wrote: >> >>> As you see, this pipeline just process simple JX template that tries >>> to access one variable >>> (status.myTasks) and fails at this point. It must fail (by throwing >>> NPE) because there is no >>> status.myTasks variable in OM! It's the flowscript code from myBlock1 >>> that is responsible for >>> setting it and that's why the only valid way to test my sample: >> >> Whether there is a variable set or not, a NPE is never good sign. >> Shouldn't this case be handled? Spring for example throws a >> NullValueInPathException instead. > > No. No to exception :) > > I suspect in this particular case (CTemplate) no exception should be > thrown at all: as far as I understand, Cocoon 2.1 will just return empty > (or null) value, but will not throw an exception. Examples: > > ${foo}, ${cocoon.foo}, ${continuation.foo} > > all return empty value, no exception.
That's problem with Jexl not CTemplate or OM (actually it is a Jexl who throws NPE). If you try this expression: ${cocoon.foo.size()} it will throw NPE because size() is internal Jexl's function that is tried to be applied to null value. I'm with all of you expecting 0 or null in this case but it's really Jexl's problem. That's the one amongst many reasons why I much prefer JXPath :P -- Grzegorz Kossakowski Committer and PMC Member of Apache Cocoon http://reflectingonthevicissitudes.wordpress.com/