You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Kin-Man Chung <Ki...@Eng.Sun.COM> on 2001/09/06 00:00:59 UTC

[PATCH] Tag attributes of type char and short bug

Date: Wed, 05 Sep 2001 14:22:21 -0700 (PDT)
From: Kin-Man Chung <Ki...@Eng.Sun.COM>
Subject: [PATH] Tag attributes of type char and short bug
To: Craig.McClanahan@sun.com
Cc: kin-man.chung@sun.com
MIME-version: 1.0
Content-transfer-encoding: 7BIT
Content-MD5: NTIF51okQsoUB2BTXXgn/Q==

This patch fixes 3366 and 3381.  This fix was provided by the submitter
simon_g_brown@yahoo.com.  This fix looks good.


Index: TagBeginGenerator.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/T
agBeginGenerator.java,v
retrieving revision 1.14
diff -u -r1.14 TagBeginGenerator.java
--- TagBeginGenerator.java      2001/07/23 19:57:32     1.14
+++ TagBeginGenerator.java      2001/09/05 21:05:28
@@ -260,7 +260,7 @@
             return "new Byte((byte)" + Byte.valueOf(s).toString() + ")";
         } else if (c == char.class) {
             // non-normative, because a normative method would fail to compile
-            if (s.length() > 1) {
+            if (s.length() > 0) {
                 char ch = s.charAt(0);
                 // this trick avoids escaping issues
                 return "((char) " + (int) ch + ")";
@@ -293,7 +293,7 @@
         } else if (c == Integer.class) {
             return "new Integer(" + Integer.valueOf(s).toString() + ")";
         } else if (c == short.class) {
-            return Short.valueOf(s).toString();
+            return "((short)" + Short.valueOf(s).toString() + ")";
         } else if (c == Short.class) {
             return "new Short(" + Short.valueOf(s).toString() + ")";
         } else if (c == long.class) {