Hi Jesse,

I found essentially the same problem in a @For loop over a list of objects
that do not implement any common interface, but (by design) have matching
method names. Tapestry would try to cast to the class of the first object in
the loop, instead of using a declared class of the loop variable. This
stalled our upgrade to 4.1.2. 

I traced it down to HiveMindExpressionCompiler.generateGetter(..), but I am
still not sure whether this is a Tapestry or OGNL bug (or rather where the
solution should be implemented). BTW where OGNL posts its releases now? I
couldn't find anything beyond 2.6.7.

I wonder if you had a chance to look into this issue? 

Thanks
Andrus Adamchik



Jessek wrote:
> 
> Thanks, I've re-opened the bug and will take a look.
> 
> On 7/10/07, Damien Uern <[EMAIL PROTECTED]> wrote:
>>
>> Hello,
>>
>> I recently upgraded to OGNL 2.7, Tapestry 4.1.2 and am experiencing the
>> same issue described here http://jira.opensymphony.com/browse/OGNL-11.
>>
>> The original poster didn't seem to provide much information, so I have
>> added a comment to that bug describing the issue I am having. I'm not
>> sure if I need to open a new bug in order for somebody to look at it.
>>
>> I will reproduce my comment here for convenience, any help/workarounds
>> would be most appreciated:
>>
>> I have just updated from Tapestry 4.0 to 4.1.2 with OGNL 2.7 and I am
>> having this same class cast exception on an ASTChain generated class,
>> stack trace is here:
>>
>> Caused by: java.lang.ClassCastException:
>> com.jigsawpublications.common.tapestry.menu.ActionLinkNode
>>         at $ASTChain_113aed5c33f.get($ASTChain_113aed5c33f.java)
>>         at
>> org.apache.tapestry.services.impl.ExpressionEvaluatorImpl.read(
>> ExpressionEvaluatorImpl.java:142)
>>
>> What we have in the component template looks like this:
>>
>> 
>> <li>
>>   parameters="ognl:getNodeIter().getAction()"
>> href="#" title="ognl:nodeIter.title">
>> 
>>  
>> </li>
>> 
>>
>> The nodeIter property on the component class is declared as follows:
>>
>> public IMenuNode getNodeIter() { ....}
>>
>> So what we have here is a list of objects all implementing this
>> interface IMenuNode, and getNodeIter() returns the current iteration as
>> set by the tapestry @For component. The class cast exception was on an
>> ActionLinkNode which implements that interface. Other classes are
>> PageLinkNode, RootNode and MenuNode. The *only* one that causes a
>> problem seems to be the above @Block component, as another block:
>>
>> 
>> <li>
>>  #  page="ognl:nodeIter.page">
>> 
>>  
>> </li>
>> 
>>
>> renders fine without any issue (these other blocks occur earlier in the
>> page than the ActionLinkBlock). If I change the actionLink block to be
>> the following (i.e. change the offending ognl expressions):
>>
>> 
>> <li>
>>   parameters="ognl:'action'"
>> href="#" title="ognl:'title'">
>> 
>>  
>> </li>
>> 
>>
>> Then I do not get an exception during the page render. This worked fine
>> with the previous version of ognl we were using (2.6.7).
>>
>> Please let me know if you require more information.
>>
>> Regards,
>>
>> Damien Uern
>>
>> --
>>
>>
>> Damien Uern
>> Online Applications Developer
>> Synect Online Solutions
>> http://www.synect.com
>>
>>
> 
> 
> -- 
> Jesse Kuhnert
> Tapestry/Dojo team member/developer
> 
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Class-cast-exception-in-ASTChain%2C-Bug-OGNL-11-tf4054151.html#a12151415
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to