Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 40209 invoked from network); 22 Mar 2005 06:58:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 22 Mar 2005 06:58:16 -0000 Received: (qmail 95904 invoked by uid 500); 22 Mar 2005 06:58:13 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 95781 invoked by uid 500); 22 Mar 2005 06:58:12 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@cocoon.apache.org Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 95768 invoked by uid 99); 22 Mar 2005 06:58:12 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from postfix4-1.free.fr (HELO postfix4-1.free.fr) (213.228.0.62) by apache.org (qpsmtpd/0.28) with ESMTP; Mon, 21 Mar 2005 22:58:11 -0800 Received: from [192.168.0.100] (lns-vlq-39f-81-56-134-235.adsl.proxad.net [81.56.134.235]) by postfix4-1.free.fr (Postfix) with ESMTP id 7591C2BC923 for ; Tue, 22 Mar 2005 07:58:08 +0100 (CET) Message-ID: <423FC1FF.8090206@apache.org> Date: Tue, 22 Mar 2005 07:58:07 +0100 From: Sylvain Wallez Organization: Anyware Technologies User-Agent: Mozilla Thunderbird 1.0 (Macintosh/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: dev@cocoon.apache.org Subject: Re: [showstopper] NPE in CForms MultivalueJXPathBinding References: <423F037A.4000505@apache.org> <423F481E.6020505@web.de> In-Reply-To: <423F481E.6020505@web.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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