...
multiValueContext.setFactory( new AbstractFactory() {
public boolean createObject(JXPathContext context, Pointer pointer,
Object parent, String name, int index) {
final Object o = context.getValue(name);
if( Collection.class.isAssignableFrom( o.getClass() ) ) {
((Collection)context.getValue(name)).add(null);
} else if( o.getClass().isArray() ) {
// not yet supported
return false;
} else {
return false;
}
return true;
}
});
...
after removing that code, the problem is gone. the NPE is thrown because o can be null.
Sylvain Wallez schrieb:
Go to http://localhost:8888/samples/blocks/forms/form2xml.flow and click "Submit Query"...
java.lang.NullPointerException
at org.apache.cocoon.forms.binding.MultiValueJXPathBinding$1.createObject(MultiValueJXPathBinding.java:111)
at org.apache.commons.jxpath.ri.model.dom.DOMNodePointer.createChild(DOMNodePointer.java:382)
at org.apache.commons.jxpath.ri.model.beans.NullPropertyPointer.createPath(NullPropertyPointer.java:125)
at org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.createPath(JXPathContextReferenceImpl.java:447)
at org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.createPath(JXPathContextReferenceImpl.java:427)
at org.apache.cocoon.forms.binding.MultiValueJXPathBinding.doSave(MultiValueJXPathBinding.java:131)
...
Giacomo, any idea?
Sylvain