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

Matcher#find is very slow when no match is found

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Not an Issue
    • Affects Version/s: 8u60
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_60"
      Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
      Java HotSpot(TM) Client VM (build 25.60-b23, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      Matcher#find method is very slow when pattern is unmached.
      The number of the group is 5.
      The number of the input data is 4.
      test case is 30min.

      REGRESSION. Last worked in version 8u60

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      The number of the group is 5.
      The number of the input data is 4.



      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.util.regex.Matcher;
      import java.util.regex.Pattern;

      public class RegTest {
      public static void main(String[] args) {

      Pattern pattern = Pattern.compile(
      "\\d{6}\\*\\s+CALL\\s+'XXXXXX'\\s+USING\\s+([\\w-]+)+\\s+"
      + "\\d{6}\\*\\s+([\\w-]+)+\\s+"
      + "\\d{6}\\*\\s+([\\w-]+)+\\s+"
      + "\\d{6}\\*\\s+([\\w-]+)+\\s+"
      + "\\d{6}\\*\\s+([\\w-]+)+\\."
      );

      String input =
      " 000000* CALL 'XXXXXX' USING XXXXXX-XXXXXX " + System.lineSeparator() +
      " 000000* XXXXXX-XXXXXX " + System.lineSeparator() +
      " 000000* XXXXXX-XXXXXX " + System.lineSeparator() +
      " 000000* XXXXXX-XXXXXX. " + System.lineSeparator();

      Matcher match = pattern.matcher(input);
      if(match.find()){
      System.out.println(match.group(0));
      System.out.println(match.group(1));
      System.out.println(match.group(2));
      System.out.println(match.group(3));
      System.out.println(match.group(4));
      }
      }
      }


      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              igerasim Ivan Gerasimov
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: