cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marco Rolappe <m_rola...@web.de>
Subject Re: [showstopper] NPE in CForms MultivalueJXPathBinding
Date Mon, 21 Mar 2005 22:18:06 GMT
these multi value problems seem to stem from the following code (which 
is not present in 2.1.6) in MultiValueJXPathBinding.doSave:

...
         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
> 

Mime
View raw message