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

Slow performance of Matcher.find

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 8u60
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b119
    • CPU:
      x86_64
    • OS:
      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

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

                Dates

                • Created:
                  Updated:
                  Resolved: