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

Slow performance of Matcher.find

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not an Issue
    • P4
    • 9
    • 8u60
    • core-libs
    • b119
    • x86_64
    • linux

    Description

      FULL PRODUCT VERSION :
      javac -version
      javac 1.8.0_31


      A DESCRIPTION OF THE PROBLEM :
      When the following regular expression is run:

      Regular expression: (?<before>.*)\{(?<reflection>\w+):(?<innerMethod>\w+(\.?\w+(\(((?<args>(('[^']*')|((/|\w)+))(,(('[^']*')|((/|\w)+)))*))?\))?)*)\}(?<after>.*)

      With processed text: {CeGlobal:getSodCutoff.getGui.getAmqp.getSimpleModeEnabled()

      Actually there is bug in text (there is missing bracket at the end), but the result is matcher is frozen at all which should not happen at all.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the attached program


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      m.find exits with the result regular expression did not match.
      ACTUAL -
      Thread which runs m.find is frozen

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      No error because application is frozen till .find

      REPRODUCIBILITY :
      This bug can be reproduced always.

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

      public class TestRegexp
      {
          public static void main(String[] args)
          {
              Matcher m = Pattern.compile("(?<before>.*)\\{(?<reflection>\\w+):(?<innerMethod>\\w+(\\.?\\w+(\\(((?<args>(('[^']*')|((/|\\w)+))(,(('[^']*')|((/|\\w)+)))*))?\\))?)*)\\}(?<after>.*)").matcher("{CeGlobal:getSodCutoff.getGui.getAmqp.getSimpleModeEnabled()");
              if (m.find())
                 System.out.println(m);
          }
      }
      ---------- END SOURCE ----------

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: