tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Howard M. Lewis Ship (JIRA)" <tapestry-...@jakarta.apache.org>
Subject [jira] Updated: (TAPESTRY-535) Colons in an OGNL expression may force it to be intepreted as a literal string, not an expression
Date Fri, 09 Sep 2005 20:37:48 GMT
     [ http://issues.apache.org/jira/browse/TAPESTRY-535?page=all ]

Howard M. Lewis Ship updated TAPESTRY-535:
------------------------------------------

    Summary: Colons in an OGNL expression may force it to be intepreted as a literal string,
not an expression  (was: When binding prefix not found, binding is treated as literal regardless
of default prefix)

> 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

>
> 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


Mime
View raw message