myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1335508 - /myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/JsonResponseWriter.java
Date Tue, 08 May 2012 13:24:33 GMT
Author: lofwyr
Date: Tue May  8 13:24:33 2012
New Revision: 1335508

URL: http://svn.apache.org/viewvc?rev=1335508&view=rev
Log:
TOBAGO-1124: Problems with Mojarra 2.0 and higher

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/JsonResponseWriter.java

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/JsonResponseWriter.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/JsonResponseWriter.java?rev=1335508&r1=1335507&r2=1335508&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/JsonResponseWriter.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/JsonResponseWriter.java
Tue May  8 13:24:33 2012
@@ -17,8 +17,10 @@ package org.apache.myfaces.tobago.intern
  * limitations under the License.
  */
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.myfaces.tobago.internal.ajax.AjaxInternalUtils;
 import org.apache.myfaces.tobago.internal.util.FastStringWriter;
+import org.apache.myfaces.tobago.util.FacesVersion;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -55,6 +57,22 @@ public class JsonResponseWriter extends 
   }
 
   @Override
+  public void write(char[] chars) throws IOException {
+    // XXX remove me later:
+    // this is a temporary workaround, should be removed after fixing the bug in Mojarra.
+    // http://java.net/jira/browse/JAVASERVERFACES-2411
+    // https://issues.apache.org/jira/browse/TOBAGO-1124
+    if (FacesVersion.isMojarra() && FacesVersion.supports20()) {
+      StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
+      if (stackTraceElements[2].getClassName().equals("com.sun.faces.renderkit.ServerSideStateHelper"))
{
+        super.write(StringUtils.replace(new String(chars), "\"", "\\\""));
+        return;
+      }
+    }
+    super.write(chars);
+  }
+
+  @Override
   public void writeJavascript(String script) throws IOException {
     writeInternal(javascriptWriter, AjaxInternalUtils.encodeJavaScriptString(script));
   }



Mime
View raw message