Author: markt
Date: Sat Nov 11 20:27:08 2006
New Revision: 473871

URL: http://svn.apache.org/viewvc?view=rev&rev=473871
Log:
Fix bug 40797. Use 0xe000 rather than 0x1b as the hack character since 0x1b 
causes problems with tld validation.
Deprecate the old constants and create new ones.

Modified:
    tomcat/container/tc5.5.x/webapps/docs/changelog.xml
    tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/Constants.java
    tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/Generator.java
    tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/JspUtil.java
    tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/Parser.java

Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?view=diff&rev=473871&r1=473870&r2=473871
==============================================================================
--- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original)
+++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Sat Nov 11 20:27:08 2006
@@ -104,7 +104,7 @@
       </fix>
       <update>
         Set the <code>SCRIPT_FILENAME</code> environment variable required
-        by PHP when using the CGIServlet to execute PHP.
+        by PHP when using the CGIServlet to execute PHP. (markt)
       </update>
       <fix>
         <bug>40823</bug>: Update context doc to clarify use of ROOT.xml,
@@ -135,6 +135,17 @@
         <bug>40771</bug>: Fix implementation of
         SavedRequestInputFilter.doRead() so POST data may be read using a
         Valve or Filter. Patch provided by Michael Dufel. (markt)
+      </fix>
+    </changelog>
+  </subsection> 
+  <subsection name="Jasper">
+    <changelog>
+      <fix>
+        <bug>40797</bug>: This was a regression as a result of the fix for
+        <bug>33407</bug>. TLD validation was failing as a result of the use
+        of the escape character (0x1b) as a temporary replacement for \$.
+        An alternative character (0xe000) from the unicode private use range
+        is now used. (markt)
       </fix>
     </changelog>
   </subsection> 

Modified: tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/Constants.java
URL: 
http://svn.apache.org/viewvc/tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/Constants.java?view=diff&rev=473871&r1=473870&r2=473871
==============================================================================
--- tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/Constants.java (original)
+++ tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/Constants.java Sat Nov 11 
20:27:08 2006
@@ -186,10 +186,30 @@
         "_jspx_temp";
 
     /**
-     * A replacement char for "\$".
-     * XXX This is a hack to avoid changing EL interpreter to recognize "\$"
+     * Previous replacement char for "\$".
+     * @deprecated
      */
     public static final char ESC='\u001b';
+    
+    /**
+     * Previous replacement char for "\$".
+     * @deprecated
+     */
     public static final String ESCStr="'\\u001b'";
+    
+    /**
+     * Replacement char for "\$". This is the first unicode character in the
+     * private use area.
+     * XXX This is a hack to avoid changing EL interpreter to recognize "\$"
+     */
+    public static final char HACK_CHAR = '\ue000';
+    
+    /**
+     * Replacement string for "\$". This is the first unicode character in the
+     * private use area.
+     * XXX This is a hack to avoid changing EL interpreter to recognize "\$"
+     */
+    public static final String HACK_STR = "'\\ue000'";
+    
 }
 

Modified: 
tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/Generator.java
URL: 
http://svn.apache.org/viewvc/tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/Generator.java?view=diff&rev=473871&r1=473870&r2=473871
==============================================================================
--- tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/Generator.java 
(original)
+++ tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/Generator.java 
Sat Nov 11 20:27:08 2006
@@ -750,7 +750,7 @@
                 }
                 return v;
             } else if (attr.isELInterpreterInput()) {
-                boolean replaceESC = v.indexOf(Constants.ESC) > 0;
+                boolean replaceESC = v.indexOf(Constants.HACK_CHAR) > 0;
                 v =
                     JspUtil.interpreterCall(
                         this.isTagFile,
@@ -758,9 +758,9 @@
                         expectedType,
                         attr.getEL().getMapName(),
                         false);
-                // XXX ESC replacement hack
+                // XXX hack replacement
                 if (replaceESC) {
-                    v = "(" + v + ").replace(" + Constants.ESCStr + ", '$')";
+                    v = "(" + v + ").replace(" + Constants.HACK_STR + ", '$')";
                 }
                 if (encode) {
                     return 
"org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode("
@@ -1888,12 +1888,13 @@
             }
 
             // Replace marker for \$ sequence with correct sequence
-            if (text.indexOf(Constants.ESC) > 0) {
+            if (text.indexOf(Constants.HACK_CHAR) > 0) {
                 if (pageInfo.isELIgnored()) {
-                    text = text.replaceAll(String.valueOf(Constants.ESC), 
"\\\\\\$");
+                    text = text.replaceAll(String.valueOf(Constants.HACK_CHAR),
+                            "\\\\\\$");
                     textSize++;
                 } else {
-                    text = text.replace(Constants.ESC, '$');
+                    text = text.replace(Constants.HACK_CHAR, '$');
                 }
             }
 
@@ -2742,7 +2743,7 @@
                 }
             } else if (attr.isELInterpreterInput()) {
                 // run attrValue through the expression interpreter
-                boolean replaceESC = attrValue.indexOf(Constants.ESC) > 0;
+                boolean replaceESC = attrValue.indexOf(Constants.HACK_CHAR) > 
0;
                 attrValue =
                     JspUtil.interpreterCall(
                         this.isTagFile,
@@ -2756,7 +2757,7 @@
                         "("
                             + attrValue
                             + ").replace("
-                            + Constants.ESCStr
+                            + Constants.HACK_STR
                             + ", '$')";
                 }
             } else {

Modified: 
tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/JspUtil.java
URL: 
http://svn.apache.org/viewvc/tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/JspUtil.java?view=diff&rev=473871&r1=473870&r2=473871
==============================================================================
--- tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/JspUtil.java 
(original)
+++ tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/JspUtil.java Sat 
Nov 11 20:27:08 2006
@@ -187,7 +187,7 @@
             returnString = expression;
         }
 
-        return escapeXml(returnString.replace(Constants.ESC, '$'));
+        return escapeXml(returnString.replace(Constants.HACK_CHAR, '$'));
     }
 
     /**

Modified: tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/Parser.java
URL: 
http://svn.apache.org/viewvc/tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/Parser.java?view=diff&rev=473871&r1=473870&r2=473871
==============================================================================
--- tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/Parser.java 
(original)
+++ tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/Parser.java Sat 
Nov 11 20:27:08 2006
@@ -289,7 +289,7 @@
                     i += 2;
                 } else if (ch == '$') {
                     // Replace "\$" with some special char.  XXX hack!
-                    buf.append(Constants.ESC);
+                    buf.append(Constants.HACK_CHAR);
                     i += 2;
                 } else {
                     buf.append('\\');
@@ -1433,7 +1433,7 @@
                 } else if(next == '$') {
                     // Skip the $ and use a hack to flag this sequence
                     reader.nextChar();
-                    ch = Constants.ESC;
+                    ch = Constants.HACK_CHAR;
                 }
             }
             ttext.write(ch);



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to