Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-6582

[classlib][luni]String.indexOf behaves wrongly if the string contains any Supplementary Characters

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 5.0M15
    • Classlib
    • None
    • Windows and Linux
    • Patch Available

    Description

      If the String contains Supplementary characters in it then String.indexof function returns wrong values in Harmony.

      If the String chars codepoint value above 0x10FFFF , then String.indexOf return wrong results.

      Consider the example below:
      if("a\ud800\udc00".indexOf(0x10000) != 1)
      System.out.println("we should not be here");
      if("ab\ud800\udc00".indexOf(0x10000, 1) != 2)
      System.out.println("we should not be here");

      Above test passes in RI and fails with harmony.

      Attachments

        1. StringIndexOf_001.diff
          2 kB
          Mohanraj Loganathan

        Activity

          People

            regis_xu Regis Xu
            mohlogan Mohanraj Loganathan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: