[ http://issues.apache.org/jira/browse/TAPESTRY-535?page=all ]
Howard M. Lewis Ship reassigned TAPESTRY-535:
---------------------------------------------
Assign To: Howard M. Lewis Ship
> When binding prefix not found, binding is treated as literal regardless of
> default prefix
> -----------------------------------------------------------------------------------------
>
> 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
>
> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]