DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=31303>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=31303 Custom Binding Summary: Custom Binding Product: Cocoon 2 Version: 2.1.5 Platform: All OS/Version: All Status: NEW Severity: Enhancement Priority: Other Component: blocks AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] In the forms binding frame work you can define a cutom binding class by extending org.apache.cocoon.forms.AbstractCustomBinding and implementing methods foLoad() and doSave(). This is nice but I think there is a little design issue in class org.apache.cocoon.forms.CustomJXPathBinding. Look at following case: * Take a JavaBean with a other bean as property named test * Make a custom binder that loads an sets this property from the JavaBean with implementation: doLoad(Widget frmModel, JXPathContext jxpc) { jxpc.setLenient(true); Object aValue = jxpc.getValue("."); jxpc.setLenient(false); if(aValue != null) frmModel.setValue(jxpc.getValue(".").toString()); } doSave(Widget frmModel, JXPathContext jxpc) { jxpc.setValue(".", LookupUtil.lookupValue(frmModel.getValue())); } and in binding xml: <fb:custom id="test" path="test" class="ch.wellernet.MyCustomBinding"/> This runs very well if test property isn't null. But is it is null an execption is throw before the code in MyCustomBinding is executed (in CustomJXPathBinding, line 68 on load, 83 on save) because relative context cannot be cerate for a null value! So I changed the AbstractCustomBinding as like this: protected abstract void doLoad(Widget frmModel, JXPathContext context, String path) throws BindingException; protected abstract void doSave(Widget frmModel, JXPathContext context, String path) throws BindingException; So I class the doXXX methods with parent context and the selection path, so it is possible to handle the null case in custom implementation. Hope this will help some one in cocoon team (and thanks a lot for your good work).
