Reviewers: Lex,

Description:
Hi Lex,

would you review this simple patch for me?  It catches the illegal XML
characters that were throwing off the SAX parser.

TODO: there are still some character that could theoretically sneak into
our xml files, see http://www.w3.org/TR/REC-xml/#charsets.  This should
be fixed.

Thanks,
kathrin

Please review this at http://gwt-code-reviews.appspot.com/61801

Affected files:
   dev/core/src/com/google/gwt/dev/util/Util.java


Index: dev/core/src/com/google/gwt/dev/util/Util.java
===================================================================
--- dev/core/src/com/google/gwt/dev/util/Util.java      (revision 5969)
+++ dev/core/src/com/google/gwt/dev/util/Util.java      (working copy)
@@ -317,7 +317,7 @@
     * equivalents. The portion of the input string between start  
(inclusive) and
     * end (exclusive) is scanned.  The output is appended to the given
     * StringBuilder.
-   *
+   *
     * @param code the input String
     * @param start the first character position to scan.
     * @param end the character position following the last character to  
scan.
@@ -330,7 +330,7 @@
      int lastIndex = 0;
      int len = end - start;
      char[] c = new char[len];
-
+
      code.getChars(start, end, c, 0);
      for (int i = 0; i < len; i++) {
        switch (c[i]) {
@@ -361,6 +361,16 @@
              lastIndex = i + 1;
            }
            break;
+        case '\0':
+          builder.append(c, lastIndex, i - lastIndex);
+          builder.append("(null)");
+          lastIndex = i + 1;
+          break;
+        case '\uffff':
+          builder.append(c, lastIndex, i - lastIndex);
+          builder.append("(\uffff)");
+          lastIndex = i + 1;
+          break;
          default:
            break;
        }



--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to