incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1549772 - /sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/ResponseUtil.java
Date Tue, 10 Dec 2013 07:19:59 GMT
Author: cziegeler
Date: Tue Dec 10 07:19:59 2013
New Revision: 1549772

URL: http://svn.apache.org/r1549772
Log:
3276 : Escape quotes and double quotes when escaping for XML

Modified:
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/ResponseUtil.java

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/ResponseUtil.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/ResponseUtil.java?rev=1549772&r1=1549771&r2=1549772&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/ResponseUtil.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/ResponseUtil.java Tue
Dec 10 07:19:59 2013
@@ -68,6 +68,10 @@ public class ResponseUtil {
                 target.write("<");
             } else if(c == '>') {
                 target.write(">");
+            } else if(c == '"') {
+                target.write(""");
+            } else if(c == '\'') {
+                target.write("'");
             } else {
                 target.write(c);
             }
@@ -85,8 +89,8 @@ public class ResponseUtil {
     }
 
     /** Escape xml text */
-    public static String escapeXml(String input) {
-        if(input == null) {
+    public static String escapeXml(final String input) {
+        if (input == null) {
             return null;
         }
 
@@ -99,6 +103,10 @@ public class ResponseUtil {
                 b.append("<");
             } else if(c == '>') {
                 b.append(">");
+            } else if(c == '"') {
+                b.append(""");
+            } else if(c == '\'') {
+                b.append("'");
             } else {
                 b.append(c);
             }



Mime
View raw message