Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 73979 invoked from network); 7 Jul 2004 16:15:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 7 Jul 2004 16:15:36 -0000 Received: (qmail 2659 invoked by uid 500); 7 Jul 2004 16:00:31 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 2091 invoked by uid 500); 7 Jul 2004 16:00:25 -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 2016 invoked by uid 99); 7 Jul 2004 16:00:23 -0000 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=DNS_FROM_RFC_ABUSE,FORGED_RCVD_HELO X-Spam-Check-By: apache.org Received: from [62.49.15.134] (HELO hermes.digitalsteps.co.uk) (62.49.15.134) by apache.org (qpsmtpd/0.27.1) with ESMTP; Wed, 07 Jul 2004 09:00:21 -0700 Received: from aeon.digitalsteps.com (aeon.digitalsteps.co.uk [192.168.1.19]) by hermes.digitalsteps.co.uk (8.10.2/8.10.2) with ESMTP id i67FuWc25207 for ; Wed, 7 Jul 2004 16:56:32 +0100 Received: from DETRITUS ([192.168.1.105]) by aeon.digitalsteps.com (Lotus Domino Release 6.5.1IF1) with ESMTP id 2004070717034060-3833 ; Wed, 7 Jul 2004 17:03:40 +0100 Received: from 127.0.0.1 (AVG SMTP 7.0.253 [263.3.11]); Wed, 07 Jul 2004 17:01:23 +0100 Message-ID: <40EC1E52.7090501@lineone.net> Date: Wed, 07 Jul 2004 17:01:22 +0100 From: Vilya Harvey User-Agent: Mozilla Thunderbird 0.7 (Windows/20040616) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Cocoon Dev Subject: ClassCastException in binding framework. X-MIMETrack: Itemize by SMTP Server on Aeon/dsl(Release 6.5.1IF1|March 16, 2004) at 07/07/2004 17:03:40, Serialize by Router on Aeon/dsl(Release 6.5.1IF1|March 16, 2004) at 07/07/2004 17:03:42, Serialize complete at 07/07/2004 17:03:42 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii; format=flowed X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hi, With the Cocoon 2.1.5 release, the binding framework throws a ClassCastException if you use anything other than an in the part of a repeater binding. Is this intentional behaviour, or a bug? The offending code comes from RepeaterJXPathBinding.java: ------------------ /** * Get the identity of the given row. That's infact a list of all the * values of the fields in the form model that constitute the identity. * @param thisRow * @return List the identity of the row */ private List getIdentity(Repeater.RepeaterRow row) { List identity = new ArrayList(); JXPathBindingBase[] childBindings = this.identityBinding.getChildBindings(); if (childBindings != null) { int size = childBindings.length; for (int i = 0; i < size; i++) { String fieldId = ((ValueJXPathBinding)childBindings[i]).getFieldId(); Widget widget = row.getChild(fieldId); Object value = widget.getValue(); identity.add(value); } } return identity; } ------------------ The first line inside the for statement, which retrieves a field ID, is where the exception occurs. If you're using an binding to generate IDs dynamically, for example, the value in the childBindings array will be an instance of JavaScriptJXPathBinding - which cannot be cast to ValueJXPathBinding. I'm guessing that the correct thing to do would be to use only methods from the JXPathBindingBase class to retrieve the identity values, but I can't see how. I'm probably overlooking something, as I'm not very familiar with the internals of the binding framework (yet!). Can anyone shed any more light on this? Cheers, Vil. -- __ o| _. / \|o._ _ _ ._ _ ._ _ _|_ \/ ||\/(_|| (|/||| |(/_(_)| |(/_o| |(/_ |_ / \__ http://website.lineone.net/~vilya