myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwald...@apache.org
Subject svn commit: r1468529 - /myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/HTMLEscapes.java
Date Tue, 16 Apr 2013 17:51:12 GMT
Author: jwaldman
Date: Tue Apr 16 17:51:12 2013
New Revision: 1468529

URL: http://svn.apache.org/r1468529
Log:
TRINIDAD-2377 surrogate characters in outputFormatted throws IllegalArgumentException
reviewed by Blake Sullivan and Yushui Du

Modified:
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/HTMLEscapes.java

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/HTMLEscapes.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/HTMLEscapes.java?rev=1468529&r1=1468528&r2=1468529&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/HTMLEscapes.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/HTMLEscapes.java
Tue Apr 16 17:51:12 2013
@@ -173,20 +173,21 @@ public class HTMLEscapes
         // character separately we might have '��', and Firefox can't
recognize these 2 decimal values as 
         // one supplementary character. Instead we need to use a single supplementary decimal
value 𠀀.
         int surrogateCodePoint = Character.codePointAt(text, i);
+        
+        buffIndex =
+            _writeDecRef(out, buff, buffIndex, surrogateCodePoint);
         // only increase i if a valid surrogate code point is returned 
         if (Character.isSupplementaryCodePoint(surrogateCodePoint))
         {
-          
-          buffIndex =
-              _writeDecRef(out, buff, buffIndex, surrogateCodePoint);
           i++;
         }
-        else
-        {
+        //else
+        //{
+          // DO NOT BLOW UP. We have a bug in outputFormatted+surrogates, and we don't want
to blow up.
           // blow up if invalid utf-16 characters encountered
-          throw new IllegalArgumentException(
-            _LOG.getMessage("INVALID_SURROGATE_CHAR", new Object[] { ch, surrogateCodePoint,
i }));
-        }
+          //throw new IllegalArgumentException(
+          //  _LOG.getMessage("INVALID_SURROGATE_CHAR", new Object[] { ch, surrogateCodePoint,
i }));
+        //}
       }
       else if (ch < 0xfffe) // characters fffe and ffff are considered outside of unicode
       {
@@ -311,19 +312,21 @@ public class HTMLEscapes
         // character separately we might have '&#55360;&#56320;', and Firefox can't
recognize these 2 decimal values as 
         // one supplementary character. Instead we need to use a single supplementary decimal
value &#131072;.
         int surrogateCodePoint = Character.codePointAt(text, i);
+
+        buffIndex =
+          _writeDecRef(out, buff, buffIndex, surrogateCodePoint);
         // only increase i if a valid surrogate code point is returned 
         if (Character.isSupplementaryCodePoint(surrogateCodePoint))
         {
-          buffIndex =
-              _writeDecRef(out, buff, buffIndex, surrogateCodePoint);
           i++;
         }
-        else
-        {
+        //else
+        //{
+          // DO NOT BLOW UP. We have a bug in outputFormatted+surrogates, and we don't want
to blow up.
           // blow up if invalid utf-16 characters encountered
-          throw new IllegalArgumentException(
-            _LOG.getMessage("INVALID_SURROGATE_CHAR", new Object[] { ch, surrogateCodePoint,
i }));
-        }
+          //throw new IllegalArgumentException(
+          //  _LOG.getMessage("INVALID_SURROGATE_CHAR", new Object[] { ch, surrogateCodePoint,
i }));
+        //}
       }
       else if (ch < 0xfffe) // characters fffe and ffff are considered outside of unicode
       {



Mime
View raw message