velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cbris...@apache.org
Subject svn commit: r1696820 - in /velocity/tools/trunk: velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/EscapeTool.java velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityViewServlet.java
Date Thu, 20 Aug 2015 17:13:44 GMT
Author: cbrisson
Date: Thu Aug 20 17:13:44 2015
New Revision: 1696820

URL: http://svn.apache.org/r1696820
Log:
handle StringEscapeTools version and API change

Modified:
    velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/EscapeTool.java
    velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityViewServlet.java

Modified: velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/EscapeTool.java
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/EscapeTool.java?rev=1696820&r1=1696819&r2=1696820&view=diff
==============================================================================
--- velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/EscapeTool.java
(original)
+++ velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/EscapeTool.java
Thu Aug 20 17:13:44 2015
@@ -21,7 +21,7 @@ package org.apache.velocity.tools.generi
 
 import java.net.URLEncoder;
 import java.io.UnsupportedEncodingException;
-import org.apache.velocity.shaded.commons.lang.StringEscapeUtils;
+import org.apache.velocity.shaded.commons.lang3.StringEscapeUtils;
 import org.apache.velocity.tools.config.DefaultKey;
 
 /**
@@ -285,7 +285,7 @@ public class EscapeTool extends SafeConf
         {
             return null;
         }
-        return StringEscapeUtils.escapeJavaScript(String.valueOf(string));
+        return StringEscapeUtils.escapeEcmaScript(String.valueOf(string));
     }
 
     /**
@@ -296,7 +296,7 @@ public class EscapeTool extends SafeConf
      * @param string the string to escape, may be null
      * @return a new escaped <code>String</code>, <code>null</code>
if null string input
      *
-     * @see StringEscapeUtils#escapeHtml(String)
+     * @see StringEscapeUtils#escapeHtml4(String)
      */
     public String html(Object string)
     {
@@ -304,7 +304,7 @@ public class EscapeTool extends SafeConf
         {
             return null;
         }
-        return StringEscapeUtils.escapeHtml(String.valueOf(string));
+        return StringEscapeUtils.escapeHtml4(String.valueOf(string));
     }
 
     /**
@@ -363,7 +363,7 @@ public class EscapeTool extends SafeConf
         {
             return null;
         }
-        return StringEscapeUtils.escapeSql(String.valueOf(string));
+        return String.valueOf(string).replace("'", "''");
     }
 
     /**

Modified: velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityViewServlet.java
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityViewServlet.java?rev=1696820&r1=1696819&r2=1696820&view=diff
==============================================================================
--- velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityViewServlet.java
(original)
+++ velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityViewServlet.java
Thu Aug 20 17:13:44 2015
@@ -34,7 +34,7 @@ import org.apache.velocity.context.Conte
 import org.apache.velocity.exception.MethodInvocationException;
 import org.apache.velocity.exception.ResourceNotFoundException;
 import org.apache.velocity.runtime.log.Log;
-import org.apache.velocity.shaded.commons.lang.StringEscapeUtils;
+import org.apache.velocity.shaded.commons.lang3.StringEscapeUtils;
 
 /**
  * <p>A servlet to process Velocity templates. This is comparable to the
@@ -361,7 +361,7 @@ public class VelocityViewServlet extends
             String why = cause.getMessage();
             if (why != null && why.length() > 0)
             {
-                html.append(StringEscapeUtils.escapeHtml(why));
+                html.append(StringEscapeUtils.escapeHtml4(why));
                 html.append("\n<br>\n");
             }
 
@@ -378,7 +378,7 @@ public class VelocityViewServlet extends
             cause.printStackTrace(new PrintWriter(sw));
 
             html.append("<pre>\n");
-            html.append(StringEscapeUtils.escapeHtml(sw.toString()));
+            html.append(StringEscapeUtils.escapeHtml4(sw.toString()));
             html.append("</pre>\n");
             html.append("</body>\n");
             html.append("</html>");



Mime
View raw message