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

the method ReplaceAll does not work correctly

XMLWordPrintable

    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10 / Java SDK 1.8

      A DESCRIPTION OF THE PROBLEM :
      This line fails
      String varS="selss";
      String rep=varS.ReplaceAll("s", "esix");
      Upon doing that gives some generic error and I think it happens because the implementation of replace just is just calling itself instead of considering that the data changed may contain the pattern too.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      String varS="selss";
      String rep=varS.ReplaceAll("s", "esix"); // this line fails

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      expected result will be varS = "esixelesixesix"
      ACTUAL -
      Program crashes

      ---------- BEGIN SOURCE ----------
      public ReplacePart(String data) {
      return varS.ReplaceAll("s", "esix");
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      did not yet


      FREQUENCY : always


            tongwan Andrew Wang
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: