svn commit: r902228 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r902228 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java

lektran
Author: lektran
Date: Fri Jan 22 19:11:27 2010
New Revision: 902228

URL: http://svn.apache.org/viewvc?rev=902228&view=rev
Log:
Removed deprecated method StringUtil.htmlSpecialChars(String, boolean, boolean, boolean), there was an undeprecated overloaded method (StringUtil.htmlSpecialChars(String)) calling this method so I've moved the implementation to it and marked it as deprecated.

Modified:
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java?rev=902228&r1=902227&r2=902228&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java Fri Jan 22 19:11:27 2010
@@ -598,13 +598,12 @@
      * Translates various HTML characters in a string so that the string can be displayed in a browser safely
      * <p>
      * This function is useful in preventing user-supplied text from containing HTML markup, such as in a message board or
-     * guest book application. The optional arguments doubleQuotes and singleQuotes allow the control of the substitution of
-     * the quote characters.  The default is to translate them with the HTML equivalent.
+     * guest book application.
      * </p>
      * The translations performed are: <ol>
      *    <li>'&' (ampersand) becomes '&amp;'
-     *    <li>'"' (double quote) becomes '&quot;' when doubleQuotes is true.
-     *    <li>''' (single quote) becomes '&#039;' when singleQuotes is true.
+     *    <li>'"' (double quote) becomes '&quot;'
+     *    <li>''' (single quote) becomes '&#039;'
      *    <li>'<' (less than) becomes '&lt;'
      *    <li>'>' (greater than) becomes '&gt;'
      *    <li>\n (Carriage Return) becomes '&lt;br&gt;gt;'
@@ -613,27 +612,17 @@
      * @deprecated Use StringUtil.htmlEncoder instead.
      */
     @Deprecated
-    public static String htmlSpecialChars(String html, boolean doubleQuotes, boolean singleQuotes, boolean insertBR) {
+    public static String htmlSpecialChars(String html) {
         html = StringUtil.replaceString(html, "&", "&amp;");
         html = StringUtil.replaceString(html, "<", "&lt;");
         html = StringUtil.replaceString(html, ">", "&gt;");
-        if (doubleQuotes) {
-            html = StringUtil.replaceString(html, "\"", "&quot;");
-        }
-        if (singleQuotes) {
-            html = StringUtil.replaceString(html, "'", "&#039");
-        }
-        if (insertBR) {
-            html = StringUtil.replaceString(html, "\n", "<br>");
-        }
+        html = StringUtil.replaceString(html, "\"", "&quot;");
+        html = StringUtil.replaceString(html, "'", "&#039");
+        html = StringUtil.replaceString(html, "\n", "<br>");
 
         return html;
     }
 
-    public static String htmlSpecialChars(String html) {
-        return htmlSpecialChars(html, true, true, true);
-    }
-
     /**
      * Remove/collapse multiple newline characters
      *