Author: markt
Date: Thu Aug 14 02:04:26 2008
New Revision: 685823

URL: http://svn.apache.org/viewvc?rev=685823&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=45015
You can't use an unescaped quote if you quote the value with that character

Modified:
    tomcat/container/tc5.5.x/webapps/docs/config/systemprops.xml
    tomcat/current/tc5.5.x/STATUS.txt
    tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/Parser.java
    
tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/resources/LocalStrings.properties

Modified: tomcat/container/tc5.5.x/webapps/docs/config/systemprops.xml
URL: 
http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/webapps/docs/config/systemprops.xml?rev=685823&r1=685822&r2=685823&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/webapps/docs/config/systemprops.xml (original)
+++ tomcat/container/tc5.5.x/webapps/docs/config/systemprops.xml Thu Aug 14 
02:04:26 2008
@@ -38,6 +38,13 @@
 <section name="Jasper">
   <properties>
 
+       <property name="org.apache.jasper.compiler. 
Parser.STRICT_QUOTE_ESCAPING">
+         <p>If <code>false</code> the requirements for escpaing quotes in JSP
+      attributes will be relaxed so that a missing required quote will not
+      cause an error. If not specified, the specification compliant default of
+      <code>true</code> will be used.</p>
+    </property>
+
     <property name="org.apache.jasper.runtime. BodyContentImpl.LIMIT_BUFFER">
       <p>If <code>true</code>, any tag buffer that expands beyond
       <code>org.apache.jasper.Constants.DEFAULT_TAG_BUFFER_SIZE</code> will be

Modified: tomcat/current/tc5.5.x/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/current/tc5.5.x/STATUS.txt?rev=685823&r1=685822&r2=685823&view=diff
==============================================================================
--- tomcat/current/tc5.5.x/STATUS.txt (original)
+++ tomcat/current/tc5.5.x/STATUS.txt Thu Aug 14 02:04:26 2008
@@ -49,13 +49,6 @@
   +1: markt, yoavs, fhanik
   -1: 
 
-* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=45015
-  You can't use an unescaped quote if you quote the value with that character
-  http://svn.apache.org/viewvc?rev=657231&view=rev
-  http://svn.apache.org/viewvc?rev=670074&view=rev
-  +1: markt, yoavs, fhanik
-  -1: 
-
 * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=45195
   NPE when calling getAttribute(null). The spec is unclear but this
   is a regression from 5.0.x Also avoid NPE on remove

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?rev=685823&r1=685822&r2=685823&view=diff
==============================================================================
--- 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 Thu 
Aug 14 02:04:26 2008
@@ -67,6 +67,11 @@
     private static final String JAVAX_BODY_CONTENT_TEMPLATE_TEXT = 
         "JAVAX_BODY_CONTENT_TEMPLATE_TEXT";
 
+    private static final boolean STRICT_QUOTE_ESCAPING = Boolean.valueOf(
+            System.getProperty(
+                    "org.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING",
+                    "true")).booleanValue();
+
     /**
      * The constructor
      */
@@ -242,7 +247,8 @@
             err.jspError(start, "jsp.error.attribute.unterminated", watch);
         }
 
-        String ret = parseQuoted(reader.getText(start, stop));
+        String ret = parseQuoted(start, reader.getText(start, stop),
+                watch.charAt(watch.length() - 1));
         if (watch.length() == 1)        // quote
             return ret;
 
@@ -261,7 +267,8 @@
      *                | '\$'
      *                | Char
      */
-    private String parseQuoted(String tx) {
+    private String parseQuoted(Mark start, String tx, char quote)
+            throws JasperException {
         StringBuffer buf = new StringBuffer();
         int size = tx.length();
         int i = 0;
@@ -295,6 +302,10 @@
                     buf.append('\\');
                     ++i;
                 }
+            } else if (ch == quote && STRICT_QUOTE_ESCAPING) {
+                // Unescaped quote character
+                err.jspError(start, "jsp.error.attribute.noescape", tx,
+                        "" + quote);
             } else {
                 buf.append(ch);
                 ++i;

Modified: 
tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/resources/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/resources/LocalStrings.properties?rev=685823&r1=685822&r2=685823&view=diff
==============================================================================
--- 
tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/resources/LocalStrings.properties
 (original)
+++ 
tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/resources/LocalStrings.properties
 Thu Aug 14 02:04:26 2008
@@ -333,6 +333,7 @@
 jsp.error.attribute.noequal=equal symbol expected
 jsp.error.attribute.noquote=quote symbol expected
 jsp.error.attribute.unterminated=attribute for {0} is not properly terminated
+jsp.error.attribute.noescape=Attribute value {0} is quoted with {1} which must 
be escaped when used within the value
 jsp.error.missing.tagInfo=TagInfo object for {0} is missing from TLD
 jsp.error.fragmentwithtype=Cannot specify both 'fragment' and 'type' 
attributes.  If 'fragment' is present, 'type' is fixed as 
'javax.servlet.jsp.tagext.JspFragment'
 jsp.error.fragmentwithrtexprvalue=Cannot specify both 'fragment' and 
'rtexprvalue' attributes.  If 'fragment' is present, 'rtexprvalue' is fixed as 
'true'



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

Reply via email to