tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <knst.koli...@gmail.com>
Subject Re: svn commit: r1140383 - in /tomcat: tc5.5.x/trunk/STATUS.txt tc6.0.x/trunk/STATUS.txt
Date Tue, 28 Jun 2011 11:21:08 GMT
2011/6/28 Mark Thomas <markt@apache.org>:
> On 28/06/2011 11:38, Konstantin Kolinko wrote:
>> 2011/6/28 Mark Thomas <markt@apache.org>:
>>
>> There is one more problem: you cannot introduce new variables that
>> will be seen by user's code, unless those are prefixed with reserved
>> prefix of "jsp_" ( "_jsp_") per JSP.9.1.2. That is because someone can
>> declare a local variable with the same name.
>
> JSP.9.1.2 certainly implies that but enforcing that would break the
> <%=attributeName%> usage. I'm happy not worrying about that for now.
>
>>> That said, I take the point regarding regressions. I'm sure lots of
>>> folks will have used <%=attributeName%> or ${attributeName} as a
>>> shortcut although I don't currently see anything to support that usage
>>> in the JSP specification.
>
> I was thinking along these lines:
>
> Index: java/org/apache/jasper/compiler/JspUtil.java
> ===================================================================
> --- java/org/apache/jasper/compiler/JspUtil.java        (revision 1140509)
> +++ java/org/apache/jasper/compiler/JspUtil.java        (working copy)
> @@ -810,10 +810,8 @@
>         }
>         for (int i = 0; i < identifier.length(); i++) {
>             char ch = identifier.charAt(i);
> -            if (Character.isJavaIdentifierPart(ch) && ch != '_') {
> +            if (Character.isJavaIdentifierPart(ch)) {
>                 modifiedIdentifier.append(ch);
> -            } else if (ch == '.') {
> -                modifiedIdentifier.append('_');
>             } else {
>                 modifiedIdentifier.append(mangleChar(ch));
>             }
>
>
> Essentially, no longer treat '.' as a special case. That removes the
> needs to escape _ which should prevent any regressions. However, I do
> wonder why '.' was treated as a special case in the first place. Time to
> do some testing...

IMHO it is '_' that was treated as special char, because mangleChar()
prepends '_' as well. Otherwise the mangling will be unreversible.

The use case of '.' is just to use shorter name for a frequent use case.
E.g. "index.jsp" -> "index_jsp.class".

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message