tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1401816 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/jasper/tagplugins/jstl/core/Out.java webapps/docs/changelog.xml
Date Wed, 24 Oct 2012 18:36:01 GMT
Author: markt
Date: Wed Oct 24 18:36:01 2012
New Revision: 1401816

URL: http://svn.apache.org/viewvc?rev=1401816&view=rev
Log:
Follow up to https://issues.apache.org/bugzilla/show_bug.cgi?id=54011
Simplify code.
Based on a patch by Sheldon Shao

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/jasper/tagplugins/jstl/core/Out.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1401814

Modified: tomcat/tc7.0.x/trunk/java/org/apache/jasper/tagplugins/jstl/core/Out.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/jasper/tagplugins/jstl/core/Out.java?rev=1401816&r1=1401815&r2=1401816&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/jasper/tagplugins/jstl/core/Out.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/jasper/tagplugins/jstl/core/Out.java Wed Oct 24 18:36:01
2012
@@ -18,6 +18,10 @@
 
 package org.apache.jasper.tagplugins.jstl.core;
 
+import java.io.IOException;
+
+import javax.servlet.jsp.JspWriter;
+
 import org.apache.jasper.compiler.tagplugin.TagPlugin;
 import org.apache.jasper.compiler.tagplugin.TagPluginContext;
 
@@ -72,20 +76,20 @@ public final class Out implements TagPlu
         }
         
         //main part. 
-        ctxt.generateJavaSource("if(null != " + strValName +"){");
-        ctxt.generateJavaSource("    if(" + strEscapeXmlName + "){");
-        ctxt.generateJavaSource("        " + strValName + " = org.apache.jasper.tagplugins.jstl.Util.escapeXml("
+ strValName + ");");
-        ctxt.generateJavaSource("    }");
-        ctxt.generateJavaSource("    out.write(" + strValName + ");");
-        ctxt.generateJavaSource("}else{");
-        ctxt.generateJavaSource("    if(null != " + strDefName + "){");
-        ctxt.generateJavaSource("        if(" + strEscapeXmlName + "){");
-        ctxt.generateJavaSource("            " + strDefName + " = org.apache.jasper.tagplugins.jstl.Util.escapeXml("
+ strDefName + ");");
-        ctxt.generateJavaSource("        }");
-        ctxt.generateJavaSource("        out.write(" + strDefName + ");");
-        ctxt.generateJavaSource("    }else{");
-        ctxt.generateBody();
-        ctxt.generateJavaSource("    }");
-        ctxt.generateJavaSource("}");   
+        ctxt.generateJavaSource(
+                "org.apache.jasper.tagplugins.jstl.core.Out.output(out, " +
+                strValName + ", " + strDefName + ", " + strEscapeXmlName +
+                ");");
+    }
+
+    public static void output(JspWriter out, String value, String defaultValue,
+            boolean escapeXml) throws IOException {
+        String v = value != null ? value : defaultValue;
+        if (v != null) {
+            if(escapeXml){
+                v = org.apache.jasper.tagplugins.jstl.Util.escapeXml(v);
+            }
+            out.write(v);
+        }
     }
 }

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1401816&r1=1401815&r2=1401816&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Wed Oct 24 18:36:01 2012
@@ -84,6 +84,10 @@
         <code>escapeXml</code> attribute was used. Patch provided by Sheldon
         Shao. (markt)
       </fix>
+      <scode>
+        Follow up to <bug>54011</bug>. Simplify generated code for
+        <code>&lt;c:out&gt;</code>. Based on a patch by Sheldon Shao.
(markt)
+      </scode>
     </changelog>
   </subsection>
   <subsection name="Cluster">



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


Mime
View raw message