You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by ra...@apache.org on 2005/10/12 20:15:56 UTC

svn commit: r314983 - /xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Saver.java

Author: radup
Date: Wed Oct 12 11:15:48 2005
New Revision: 314983

URL: http://svn.apache.org/viewcvs?rev=314983&view=rev
Log:
Fix for XMLBEANS-192. The character sequence ]]> should not be output with the > unescaped unless it marks the end of a CDATA section.

Contributed by Lawrence Jones

Modified:
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Saver.java

Modified: xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Saver.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Saver.java?rev=314983&r1=314982&r2=314983&view=diff
==============================================================================
--- xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Saver.java (original)
+++ xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Saver.java Wed Oct 12 11:15:48 2005
@@ -1207,17 +1207,24 @@
             boolean hasCharToBeReplaced = false;
 
             int count = 0;
+            char prevChar = 0;
+            char prevPrevChar = 0;
             for ( int cch = _lastEmitCch ; cch > 0 ; cch-- )
             {
                 char ch = _buf[ i ];
 
                 if (ch == '<' || ch == '&')
                     count++;
+                else if (prevPrevChar == ']' && prevChar == ']' && ch == '>' )
+                    hasCharToBeReplaced = true;
                 else if (isBadChar( ch ) || isEscapedChar( ch ))
                     hasCharToBeReplaced = true;
 
                 if (++i == n)
                     i = 0;
+
+                prevPrevChar = prevChar;
+                prevChar = ch;
             }
 
             if (count == 0 && !hasCharToBeReplaced)



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: commits-help@xmlbeans.apache.org