You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by vi...@apache.org on 2014/06/25 15:48:17 UTC

svn commit: r1605402 - in /tomcat/trunk: java/org/apache/tomcat/util/descriptor/web/WebXml.java webapps/docs/changelog.xml

Author: violetagg
Date: Wed Jun 25 13:48:17 2014
New Revision: 1605402

URL: http://svn.apache.org/r1605402
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56665
Correct the generation of the effective web.xml when elements contain an empty string as value.

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/descriptor/web/WebXml.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/tomcat/util/descriptor/web/WebXml.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/descriptor/web/WebXml.java?rev=1605402&r1=1605401&r2=1605402&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/descriptor/web/WebXml.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/descriptor/web/WebXml.java Wed Jun 25 13:48:17 2014
@@ -1299,15 +1299,24 @@ public class WebXml {
 
     private static void appendElement(StringBuilder sb, String indent,
             String elementName, String value) {
-        if (value == null || value.length() == 0) return;
-        sb.append(indent);
-        sb.append('<');
-        sb.append(elementName);
-        sb.append('>');
-        sb.append(escapeXml(value));
-        sb.append("</");
-        sb.append(elementName);
-        sb.append(">\n");
+        if (value == null) {
+            return;
+        }
+        if (value.length() == 0) {
+            sb.append(indent);
+            sb.append('<');
+            sb.append(elementName);
+            sb.append("/>\n");
+        } else {
+            sb.append(indent);
+            sb.append('<');
+            sb.append(elementName);
+            sb.append('>');
+            sb.append(escapeXml(value));
+            sb.append("</");
+            sb.append(elementName);
+            sb.append(">\n");
+        }
     }
 
     private static void appendElement(StringBuilder sb, String indent,

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1605402&r1=1605401&r2=1605402&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Wed Jun 25 13:48:17 2014
@@ -80,6 +80,10 @@
         Remove <code>context</code> and <code>wrapper</code> fields and setters
         from <code>Request</code> class. (kkolinko)
       </scode>
+      <fix>
+        <bug>56665</bug>: Correct the generation of the effective web.xml when
+        elements contain an empty string as value. (violetagg)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Web applications">



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