cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <joerg.heini...@gmx.de>
Subject Re: ClassCastException in binding framework.
Date Wed, 07 Jul 2004 21:43:08 GMT
On 07.07.2004 18:01, Vilya Harvey wrote:

> With the Cocoon 2.1.5 release, the binding framework throws a 
> ClassCastException if you use anything other than an <fb:value> in the 
> <fb:identity> part of a repeater binding. Is this intentional behaviour, 
> or a bug?

It's a known feature ;-)
http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=107906438632484&w=4

> The first line inside the for statement, which retrieves a field ID, is 
> where the exception occurs. If you're using an <fb:javascript> 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?

Getting the value is exactly the problem. As you can read in the 
mail/thread mentioned above I added the getFieldId() method only to the 
ValueJXPathBinding to get it working at all, but it is a bad dependency, 
so this dependency was not introduced to the interface or base class.

It might work for you the same way as I did it here:
http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/blocks/forms/samples/forms/form2_bind_xml.xml?annotate=1.4#71.

Joerg

Mime
View raw message