I'm attempting to put OGNL to use and think I have uncovered a bug in
Tapestry's OGNL implementation.

I have two assets defined, either of which works fine in the following
context:

  <binding name="image" expression="assets.menu_item"/>

However, if I specify the expression as follows:

<binding name="image" expression='visit.selectedMenuItem.equals("Selected")
? "assets.menu_item_selected" : "assets.menu_item" '/>

I get "Parameter image (assets.menu_item_selected) does not implement
interface net.sf.tapestry.IAsset".

I've walked through this in the debugger and OGNL is returning the value I
expect so don't think that's the problem.  If I step through the first
example, Tapestry's ExpressionBinding.getObject method recognizes the string
as _invariant and returns a _cachedValue of type ContextAsset.  That doesn't
happen with the second expression ... in that case we're no longer
_invariant so ExpressionBinding.resolveProperty gets called, ONGL does its
thing, and the result turns out to be a String instead of a ContextAsset.
At that point, ExpressionBinding's type.isAssignable test fails and the
exception is thrown.

I'm assuming you intend to allow OGNL expressions of this type ... very nice
indeed ... and that there's a simple fix that will allow asset
identification after we've finished the evaluation.  I could take a stab at
it, but you're better qualified.





-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
Tapestry-developer mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/tapestry-developer

Reply via email to