Harmony
  1. Harmony
  2. HARMONY-6582

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

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.0M15
    • Component/s: Classlib
    • Labels:
      None
    • Environment:
      Windows and Linux
    • Patch Info:
      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.

      1. StringIndexOf_001.diff
        2 kB
        Mohanraj Loganathan

        Activity

        Hide
        Mohanraj Loganathan added a comment -

        attaching patch for the above issue

        Show
        Mohanraj Loganathan added a comment - attaching patch for the above issue
        Hide
        Mohanraj Loganathan added a comment -

        In the description above it should be 'String chars codepoint value above 0xFFFF' instead 'String chars codepoint value above 0x10FFFF'

        Show
        Mohanraj Loganathan added a comment - In the description above it should be 'String chars codepoint value above 0xFFFF' instead 'String chars codepoint value above 0x10FFFF'
        Hide
        Regis Xu added a comment -

        Thanks Mohan,

        Patch was applied to trunk at r964697, please verify.

        Show
        Regis Xu added a comment - Thanks Mohan, Patch was applied to trunk at r964697, please verify.
        Hide
        Hudson added a comment -

        Integrated in Harmony-1.5-head-linux-x86_64 #895 (See http://hudson.zones.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/895/)
        Apply patch for HARMONY-6582: [classlib][luni]String.indexOf behaves wrongly if the string contains any Supplementary Characters

        Show
        Hudson added a comment - Integrated in Harmony-1.5-head-linux-x86_64 #895 (See http://hudson.zones.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/895/ ) Apply patch for HARMONY-6582 : [classlib] [luni] String.indexOf behaves wrongly if the string contains any Supplementary Characters
        Hide
        Hudson added a comment -

        Integrated in Harmony-select-1.5-head-linux-x86_64 #66 (See http://hudson.zones.apache.org/hudson/job/Harmony-select-1.5-head-linux-x86_64/66/)
        Apply patch for HARMONY-6582: [classlib][luni]String.indexOf behaves wrongly if the string contains any Supplementary Characters

        Show
        Hudson added a comment - Integrated in Harmony-select-1.5-head-linux-x86_64 #66 (See http://hudson.zones.apache.org/hudson/job/Harmony-select-1.5-head-linux-x86_64/66/ ) Apply patch for HARMONY-6582 : [classlib] [luni] String.indexOf behaves wrongly if the string contains any Supplementary Characters
        Hide
        Mohanraj Loganathan added a comment -

        Thanks Regis, I verified @ r965571

        Show
        Mohanraj Loganathan added a comment - Thanks Regis, I verified @ r965571

          People

          • Assignee:
            Regis Xu
            Reporter:
            Mohanraj Loganathan
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development