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: r1406384 - /tomcat/trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
Date Tue, 06 Nov 2012 23:03:25 GMT
2012/11/7  <markt@apache.org>:
> Author: markt
> Date: Tue Nov  6 22:35:55 2012
> New Revision: 1406384
>
> URL: http://svn.apache.org/viewvc?rev=1406384&view=rev
> Log:
> Remove unnecessary casts and comment that does not make sense
>
> Modified:
>     tomcat/trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
>
> Modified: tomcat/trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java?rev=1406384&r1=1406383&r2=1406384&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java (original)
> +++ tomcat/trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java Tue Nov  6 22:35:55
2012
> @@ -133,8 +133,7 @@ public class JspRuntimeLibrary {
>          if (s == null || s.length() == 0) {
>              return (char) 0;
>          } else {
> -            // this trick avoids escaping issues
> -            return (char)(int) s.charAt(0);
> +            return s.charAt(0);
>          }
>      }

Just noting that I am OK with this change.

1) The (char)(int) trick would make sense if the original data were a
byte or an int. It makes no sense if the original data is a char.

For a byte the trick is needed to get rid of the sign (for an
ISO-8859-1 character in the range 128-255).

2) Quickly looking what the spec says. The JSP one says to use the EL
rules (JSP.2.3.2, JSP.2.3.4). The EL one (1.18.4) says to just call
charAt(0) here.

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