These were in the submit for r8652, not sure why they didn't update then!



git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@8653 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/safehtml/shared/SafeHtmlUtils.java b/user/src/com/google/gwt/safehtml/shared/SafeHtmlUtils.java
index 0502c7e..f359a86 100644
--- a/user/src/com/google/gwt/safehtml/shared/SafeHtmlUtils.java
+++ b/user/src/com/google/gwt/safehtml/shared/SafeHtmlUtils.java
@@ -16,7 +16,6 @@
 package com.google.gwt.safehtml.shared;
 
 import com.google.gwt.regexp.shared.RegExp;
-import com.google.gwt.regexp.shared.SplitResult;
 
 /**
  * Utility class containing static methods for escaping and sanitizing strings.
@@ -113,16 +112,16 @@
   public static String htmlEscapeAllowEntities(String text) {
     StringBuilder escaped = new StringBuilder();
 
-    SplitResult splitSegment = AMP_RE.split(text, -1);
-    for (int i = 0, len = splitSegment.length(); i < len; i++) {
-      String segment = splitSegment.get(i);
-      if (i == 0) {
+    boolean firstSegment = true;
+    for (String segment : text.split("&", -1)) {
+      if (firstSegment) {
         /*
          * The first segment is never part of an entity reference, so we always
          * escape it.
          * Note that if the input starts with an ampersand, we will get an empty
          * segment before that.
          */
+        firstSegment = false;
         escaped.append(htmlEscape(segment));
         continue;
       }
diff --git a/user/src/com/google/gwt/safehtml/shared/SimpleHtmlSanitizer.java b/user/src/com/google/gwt/safehtml/shared/SimpleHtmlSanitizer.java
index 4f761b1..0e25278 100644
--- a/user/src/com/google/gwt/safehtml/shared/SimpleHtmlSanitizer.java
+++ b/user/src/com/google/gwt/safehtml/shared/SimpleHtmlSanitizer.java
@@ -16,7 +16,6 @@
 package com.google.gwt.safehtml.shared;
 
 import com.google.gwt.regexp.shared.RegExp;
-import com.google.gwt.regexp.shared.SplitResult;
 
 import java.util.Arrays;
 import java.util.HashSet;
@@ -79,15 +78,15 @@
   private static String simpleSanitize(String text) {
     StringBuilder sanitized = new StringBuilder();
 
-    SplitResult splitSegment = LT_RE.split(text, -1);
-    for (int i = 0, len = splitSegment.length(); i < len; i++) {
-      String segment = splitSegment.get(i);
-      if (i == 0) {
+    boolean firstSegment = true;
+    for (String segment : text.split("<", -1)) {
+      if (firstSegment) {
         /*
          *  the first segment is never part of a valid tag; note that if the
          *  input string starts with a tag, we will get an empty segment at the 
          *  beginning.
          */
+        firstSegment = false;
         sanitized.append(SafeHtmlUtils.htmlEscapeAllowEntities(segment));
         continue;
       }