You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Howard M. Lewis Ship (JIRA)" <ta...@jakarta.apache.org> on 2005/09/09 22:49:32 UTC
[jira] Closed: (TAPESTRY-535) Colons in an OGNL expression may force it to be intepreted as a literal string, not an expression
[ http://issues.apache.org/jira/browse/TAPESTRY-535?page=all ]
Howard M. Lewis Ship closed TAPESTRY-535:
-----------------------------------------
Fix Version: 4.0
Resolution: Fixed
> Colons in an OGNL expression may force it to be intepreted as a literal string, not an expression
> -------------------------------------------------------------------------------------------------
>
> Key: TAPESTRY-535
> URL: http://issues.apache.org/jira/browse/TAPESTRY-535
> Project: Tapestry
> Type: Bug
> Components: Framework
> Versions: 4.0
> Environment: Windows XP
> Reporter: Kent Tong
> Assignee: Howard M. Lewis Ship
> Fix For: 4.0
>
> For a binding like this:
> <component id="foo" type="Insert">
> <binding name="value" value="ognl:getCapitalized('a:b')"/>
> </component>
> works and will output "A:B". But if the ognl prefix is not specified (it is the default):
> <component id="foo" type="Insert">
> <binding name="value" value="getCapitalized('a:b')"/>
> </component>
> Then it will output "getCapitalized('a:b')". That is, it is treating it as a literal, not an ognl.
> This is because the BindingSource is misled by the colon in 'a:b' to believe that
> the binding prefix "getCapitalized('a". So the prefix is unknown. Then it is treating
> unknown prefix as literal:
> public class BindingSourceImpl implements BindingSource
> {
> public IBinding createBinding(IComponent component, String bindingDescription,
> String reference, String defaultPrefix, Location location)
> {
> String prefix = defaultPrefix;
> String path = reference;
> int colonx = reference.indexOf(':');
> if (colonx > 1) //Step1: blindingly looking for a colon
> {
> prefix = reference.substring(0, colonx);
> if (_factoryMap.containsKey(prefix))
> path = reference.substring(colonx + 1);
> }
> BindingFactory factory = (BindingFactory) _factoryMap.get(prefix); //Step2: unknown prefix
> if (factory == null)
> factory = _literalBindingFactory; //Step3: treat unknown prefix as literal
> return factory.createBinding(component, bindingDescription, path, location);
> }
> }
> I'd suggest that the prefix should be checked to see if it contains alphabet chars only. If yes, go
> ahead with the existing logic. If not, it should be treated as no prefix is provided (so the default
> prefix should be used). For an unknown prefix, the existing logic can still be applied (or should
> throw an exception?).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org