Harmony
  1. Harmony
  2. HARMONY-348

java.lang.StringBuilder.replace does not get right result

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Classlib
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      java.lang.StringBuilder.replace(start,end, str) should replace the substring starting at param start and ending at param end -1 with the str parameter, but the Harmony's implementation's behavior is not compliant with spec and RI. The following test case reproduce the bug:

      public void test_replace()

      { StringBuilder buffer = new StringBuilder("1234567"); buffer.replace(2, 6, "XXX"); assertEquals("12XXX7",buffer.toString()); }

      RI(Sun JDK 1.5.0_06) passed
      Harmony failed

      1. harmony-348.diff
        0.9 kB
        Sergey Soldatov

        Activity

        Hide
        Sergey Soldatov added a comment -

        This patch should fix the problem. Handler for case when the substring is longer than the specified string has been added.

        Show
        Sergey Soldatov added a comment - This patch should fix the problem. Handler for case when the substring is longer than the specified string has been added.
        Hide
        Tim Ellison added a comment -

        Thanks Paulex.

        Fixed in LUNI module java.lang.StringBuilder at repo revision 399206.

        Please verify that this fully resolves your problem.

        Show
        Tim Ellison added a comment - Thanks Paulex. Fixed in LUNI module java.lang.StringBuilder at repo revision 399206. Please verify that this fully resolves your problem.
        Hide
        Paulex Yang added a comment -

        the fix looks fine. Thank you, Sergey and Tim.

        Show
        Paulex Yang added a comment - the fix looks fine. Thank you, Sergey and Tim.
        Hide
        Tim Ellison added a comment -

        Verified by Paulex.

        Show
        Tim Ellison added a comment - Verified by Paulex.

          People

          • Assignee:
            Tim Ellison
            Reporter:
            Paulex Yang
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development