Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8043324

java.lang.String.split ignores the 1st null element in JDK 8

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Not an Issue
    • Affects Version/s: 8
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:

      Description

      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 ----------

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sherman Xueming Shen
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: