cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Portier <>
Subject Re: Lenient Woody Binding
Date Mon, 01 Sep 2003 10:51:30 GMT

Konstantin Piroumian wrote:

> From: "Marc Portier" <>
>>Hi all,
>>Woody binding currently breaks if the xpath's to bind to don't exist in
>>the XML (or JavaBean)
>>This 'breaking' is manifesting itself through a JXPathException
>>(org.apache.commons.jxpath.*) being thrown.
>>The JXpath API offers a 'lenient' setting to change this behaviour into
>>just returning a 'null' (see jxpath javadoc at [1])
> There is also an option to use:
> context.createPathAndSetValue("address/zipCode", "90190");

nice to know!

Currently I was only thinking about the loadFormFromModel direction 
(where only getValue() and getPointer() are used), but surely this is 
what we would need in the other direction: saveFormToModel

in that case this will probably trigger the registered factory so the 
insert-node binding could be reused in this context as well.



> to avoid NPEs or setting the lenient mode. This way you can be sure that the
> specified path will be created and the value is set to it. Though, I'm not
> sure if it's a good idea from security POV.

why would you think it harms security?

> -- Konstantin
>>The danger in just using that last option is that (e.g for the
>>ContextBinding) the current exception would be covered up but instead
>>lead to a NPE further down the processing (which would arguably be
>>harder to debug/spot)
>>Furthermore, I can see environments were people would rather be
>>confronted with the failing XML and see the exception, so I guess it
>>needs to end up as a binding-config file setting. (probably an @lenient
>>on each component that has some kind of @path in its config)
>>In order for Binding to gracefully survive (in a best effort manner) the
>>various binding components should thus know their own 'lenient' mode,
>>check for null returns and stop any nested child bindings if a null was
>>The lenient member of each binding component should allow for 3 states:
>>- null (not set): meaning take it as it comes from the parent binding,
>>- true or false : meaning change the jxpath context lenient mode further
>>I plan to make the changes in code and docos on this today.
>>Any comments welcome.
>>Marc Portier                  
>>Outerthought - Open Source, Java & XML Competence Support Center
>>Read my weblog at    

Marc Portier                  
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at                        

View raw message