You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2012/05/19 00:14:06 UTC

svn commit: r1340282 - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/ tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/

Author: bommel
Date: Fri May 18 22:14:05 2012
New Revision: 1340282

URL: http://svn.apache.org/viewvc?rev=1340282&view=rev
Log:
(TOBAGO-1138) Avoid using String.replace inside ResponseWriter

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/JavascriptWriterUtils.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/JavascriptWriterUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/JavascriptWriterUtils.java?rev=1340282&r1=1340281&r2=1340282&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/JavascriptWriterUtils.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/JavascriptWriterUtils.java Fri May 18 22:14:05 2012
@@ -32,12 +32,12 @@ public final class JavascriptWriterUtils
       CHARS_TO_ESCAPE[i] = EMPTY; // Control characters
     }
 
-    CHARS_TO_ESCAPE['\t'] = "	".toCharArray(); // Horizontal tabulator
-    CHARS_TO_ESCAPE['\n'] = "
".toCharArray(); // Line feed
-    CHARS_TO_ESCAPE['\r'] = "
".toCharArray(); // Carriage return
+    CHARS_TO_ESCAPE['\t'] = "\\n".toCharArray(); // Horizontal tabulator
+    CHARS_TO_ESCAPE['\n'] = "\\n".toCharArray(); // Line feed
+    CHARS_TO_ESCAPE['\r'] = "\\r".toCharArray(); // Carriage return
 
-    CHARS_TO_ESCAPE['"'] = """.toCharArray();
-    CHARS_TO_ESCAPE['\\'] = "\\\\".toCharArray();
+    CHARS_TO_ESCAPE['"'] = "\\\"".toCharArray();
+    CHARS_TO_ESCAPE['\\'] = "\\\\\\\\".toCharArray();
 
     CHARS_TO_ESCAPE[0x7F] = EMPTY; // Delete
 

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java?rev=1340282&r1=1340281&r2=1340282&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java Fri May 18 22:14:05 2012
@@ -191,9 +191,9 @@ public class InRenderer extends InputRen
         writer.write(", ");
       }
       writer.write("{label: \"");
-      writer.write(AjaxInternalUtils.encodeJavaScriptString(suggestItem.getLabel()));
+      writer.write(suggestItem.getLabel());
       writer.write("\", value: \"");
-      writer.write(AjaxInternalUtils.encodeJavaScriptString(suggestItem.getValue()));
+      writer.write(suggestItem.getValue());
       writer.write("\"");
       if (suggestItem.getExtensionItems() != null) {
         writer.write(", values: [");
@@ -205,14 +205,14 @@ public class InRenderer extends InputRen
           writer.write("{id: \"");
           writer.write(item.getId());
           writer.write("\", value: \"");
-          writer.write(AjaxInternalUtils.encodeJavaScriptString(item.getValue()));
+          writer.write(item.getValue());
           writer.write("\"}");
         }
         writer.write("]");
       }
       if (suggestItem.getNextFocusId() != null) {
         writer.write(", nextFocusId: \"");
-        writer.write(AjaxInternalUtils.encodeJavaScriptString(suggestItem.getNextFocusId()));
+        writer.write(suggestItem.getNextFocusId());
         writer.write("\"");
       }