aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsherman <none@none>2013-11-13 22:22:28 -0800
committersherman <none@none>2013-11-13 22:22:28 -0800
commit2fff6ba2c09e425bd4c9f837d347295892c7e7f7 (patch)
treecf845a6acd43f7bfab65b7413b943758439f70e9 /src
parent9ca9c13b549e9dd1920a51f03e54085bf8f218cd (diff)
8028321: Fix for String.split() empty input sequence/JDK-6559590 triggers regression
Summary: to undo the change for 6559590 Reviewed-by: darcy
Diffstat (limited to 'src')
-rw-r--r--src/share/classes/java/lang/String.java5
-rw-r--r--src/share/classes/java/util/regex/Pattern.java9
2 files changed, 3 insertions, 11 deletions
diff --git a/src/share/classes/java/lang/String.java b/src/share/classes/java/lang/String.java
index a561c5d59..e0a73d557 100644
--- a/src/share/classes/java/lang/String.java
+++ b/src/share/classes/java/lang/String.java
@@ -2235,8 +2235,7 @@ public final class String
* expression or is terminated by the end of the string. The substrings in
* the array are in the order in which they occur in this string. If the
* expression does not match any part of the input then the resulting array
- * has just one element, namely this string. A zero-length input sequence
- * always results zero-length resulting array.
+ * has just one element, namely this string.
*
* <p> When there is a positive-width match at the beginning of this
* string then an empty leading substring is included at the beginning
@@ -2331,8 +2330,6 @@ public final class String
(ch < Character.MIN_HIGH_SURROGATE ||
ch > Character.MAX_LOW_SURROGATE))
{
- if (value.length == 0)
- return new String[0];
int off = 0;
int next = 0;
boolean limited = limit > 0;
diff --git a/src/share/classes/java/util/regex/Pattern.java b/src/share/classes/java/util/regex/Pattern.java
index f1bb37c63..b5578b6a9 100644
--- a/src/share/classes/java/util/regex/Pattern.java
+++ b/src/share/classes/java/util/regex/Pattern.java
@@ -1144,8 +1144,7 @@ public final class Pattern
* substrings in the array are in the order in which they occur in the
* input. If this pattern does not match any subsequence of the input then
* the resulting array has just one element, namely the input sequence in
- * string form. A zero-length input sequence always results zero-length
- * resulting array.
+ * string form.
*
* <p> When there is a positive-width match at the beginning of the input
* sequence then an empty leading substring is included at the beginning
@@ -1201,8 +1200,6 @@ public final class Pattern
* around matches of this pattern
*/
public String[] split(CharSequence input, int limit) {
- if (input.length() == 0)
- return new String[0];
int index = 0;
boolean matchLimited = limit > 0;
ArrayList<String> matchList = new ArrayList<>();
@@ -5767,15 +5764,13 @@ NEXT: while (i <= last) {
* input sequence that is terminated by another subsequence that matches
* this pattern or is terminated by the end of the input sequence. The
* substrings in the stream are in the order in which they occur in the
- * input. Trailing empty strings will be discarded and not encountered in
+ * input. Trailing empty strings will be discarded and not encountered in
* the stream.
*
* <p> If this pattern does not match any subsequence of the input then
* the resulting stream has just one element, namely the input sequence in
* string form.
*
- * <p> A zero-length input sequence always results an empty stream.
- *
* <p> When there is a positive-width match at the beginning of the input
* sequence then an empty leading substring is included at the beginning
* of the stream. A zero-width match at the beginning however never produces