-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
8
-
generic
FULL PRODUCT VERSION :
C:\Users\hkc786>java -version
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
C:\Users\hkc786>ver
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
java.lang.String.split ignores the 1st null element in java8 (build 1.8.0_05-b13) but exist in java7 (build 1.7.0_55-b13)
ADDITIONAL REGRESSION INFORMATION:
C:\Users\hkc786\Desktop>"C:\Program Files\Java\jre7\bin\java" -version
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Compile eapJdkRegexTest using Java 7
2. Run the program in both Java 7 and Java 8.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
C:\Users\hkc786\Desktop>"C:\Program Files\Java\jre7\bin\java" eapJdkRegexTest
splitedPascalCase[0] :
splitedPascalCase[1] : Hello
splitedPascalCase[2] : I
splitedPascalCase[3] : Am
splitedPascalCase[4] : Pascal
splitedPascalCase[5] : Case
ACTUAL -
C:\Users\hkc786\Desktop>java eapJdkRegexTest
splitedPascalCase[0] : Hello
splitedPascalCase[1] : I
splitedPascalCase[2] : Am
splitedPascalCase[3] : Pascal
splitedPascalCase[4] : Case
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class eapJdkRegexTest {
public static void main (String[] args) {
String PascalCase = "HelloIAmPascalCase";
String[] splitedPascalCase = PascalCase.split("(?=\\p{javaUpperCase})");
for (int i = 0; i < splitedPascalCase.length; i++) {
System.out.println("splitedPascalCase[" + i + "] : " + splitedPascalCase[i]);
}
}
---------- END SOURCE ----------
C:\Users\hkc786>java -version
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
C:\Users\hkc786>ver
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
java.lang.String.split ignores the 1st null element in java8 (build 1.8.0_05-b13) but exist in java7 (build 1.7.0_55-b13)
ADDITIONAL REGRESSION INFORMATION:
C:\Users\hkc786\Desktop>"C:\Program Files\Java\jre7\bin\java" -version
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Compile eapJdkRegexTest using Java 7
2. Run the program in both Java 7 and Java 8.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
C:\Users\hkc786\Desktop>"C:\Program Files\Java\jre7\bin\java" eapJdkRegexTest
splitedPascalCase[0] :
splitedPascalCase[1] : Hello
splitedPascalCase[2] : I
splitedPascalCase[3] : Am
splitedPascalCase[4] : Pascal
splitedPascalCase[5] : Case
ACTUAL -
C:\Users\hkc786\Desktop>java eapJdkRegexTest
splitedPascalCase[0] : Hello
splitedPascalCase[1] : I
splitedPascalCase[2] : Am
splitedPascalCase[3] : Pascal
splitedPascalCase[4] : Case
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class eapJdkRegexTest {
public static void main (String[] args) {
String PascalCase = "HelloIAmPascalCase";
String[] splitedPascalCase = PascalCase.split("(?=\\p{javaUpperCase})");
for (int i = 0; i < splitedPascalCase.length; i++) {
System.out.println("splitedPascalCase[" + i + "] : " + splitedPascalCase[i]);
}
}
---------- END SOURCE ----------
- relates to
-
JDK-8027645 Pattern.split() with positive lookahead
- Closed