cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Re: [showstopper] NPE in CForms MultivalueJXPathBinding
Date Tue, 22 Mar 2005 06:58:07 GMT
Marco Rolappe wrote:

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


Ok, got it: we must merge this with o.a.c.util.JXPath.DOMFactory which 
is set as the factory at the start of the binding tree traversal.

That will allow to bind to collections *and* XML documents!

Sylvain

-- 
Sylvain Wallez                        Anyware Technologies
http://apache.org/~sylvain            http://anyware-tech.com
Apache Software Foundation Member     Research & Technology Director


Mime
View raw message