test/java/lang/String/Split.java

Print this page

        

@@ -21,11 +21,11 @@
  * questions.
  */
 
 /**
  * @test
- * @bug 6840246
+ * @bug 6840246 6559590
  * @summary test String.split()
  */
 import java.util.Arrays;
 import java.util.Random;
 import java.util.regex.*;

@@ -76,16 +76,15 @@
                 throw new RuntimeException("String.split failure 6");
             if (!result[0].equals(source))
                 throw new RuntimeException("String.split failure 7");
         }
         // Check the case for limit == 0, source = "";
+        // split() now returns 0-length for empty source "" see #6559590
         source = "";
         String[] result = source.split("e", 0);
-        if (result.length != 1)
+        if (result.length != 0)
             throw new RuntimeException("String.split failure 8");
-        if (!result[0].equals(source))
-            throw new RuntimeException("String.split failure 9");
 
         // check fastpath of String.split()
         source = "0123456789abcdefgABCDEFG";
         Random r = new Random();