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

java.util.regex.Matcher: Performance issue

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 1.4.2
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b119
    • CPU:
      x86
    • OS:
      windows_2000

      Description

      FULL PRODUCT VERSION :
      java version "1.5.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
      Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode)

      java version "1.4.2_06-ea"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-ea-b01)
      Java HotSpot(TM) Client VM (build 1.4.2_06-ea-b01, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      4DOS for Windows NT 2,52A Windows NT 5,0

      A DESCRIPTION OF THE PROBLEM :
      Application hangs when using Unicode characters that are not non-US-ASCII (like ç). But only when the special characters occur at the end of the input string.
      "Hello World this ç is a test this is a test" works fine (62 ms)
      "Hello World this is a test this is a test ç " hangs (22063 ms)



      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.util.regex.*;

      class Test159 {
          public static void main(String[] args) {
              String pat = " *([a-zA-Z0-9/\\-\\?:\\(\\)\\.,'\\+\\{\\}]+ *)+";
              String input = "ü Hello World this is a test this is a test"; // 0 ms
              String input1 = "Hello World this ü is a test this is a test"; // 62 ms
              String inputLags = "Hello World this is a test this is a test ç "; // 21300 ms
              Pattern pattern = Pattern.compile(pat);
              Matcher matcher = pattern.matcher(inputLags);
              long t = System.currentTimeMillis();
              boolean isMatched = matcher.matches();
              System.out.println ("took " + (System.currentTimeMillis() - t) + " ms");
          }
      }

      ---------- END SOURCE ----------
      ###@###.### 2004-11-09 19:00:42 GMT

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sherman Xueming Shen
                Reporter:
                rmandalasunw Ranjith Mandala (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: