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

Matcher.matches() enters in an infinite loop

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • tbd
    • 7
    • core-libs

      FULL PRODUCT VERSION :
      java version "1.7.0"
      Java(TM) SE Runtime Environment (build 1.7.0-b147)
      Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [version 6.1.7601]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Not relevant

      A DESCRIPTION OF THE PROBLEM :
      The matcher.match() method never returns when called with specific pattern and string to match

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile and execute the provided code.
      It just declare a specific Pattern and match a string (any string that looks like the provided one will trigger the bug too).

      It's obvious that an expression like
      string.matches(pattern)
      triggers the bug too.



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The program should terminate gracefully.
      ACTUAL -
      The program never ends.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      No error message is displayed

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public static void main(String[] args) {
      String s1 = "a().characteristics.characteristics.characteristics;";
      Pattern pat = Pattern.compile("(?<assignationtype>[^=(new|throw new)]\\w+\\s+)?(?:(?<assignationTargets>(?<assignationtarget>\\w+\\.)*)(?<assignation>\\w+(?:\\[\\w+\\])?\\s*(?:=|:\\*=)\\s*))?(?<stereotype>new|throw new)?\\s?(?<targets>(?<target>[^\\.]+\\.)*)(?<name>[_\\w]+)\\((?<arguments>(?<argument>[^,]+,?)*)\\);");
      Matcher matcher = pat.matcher(s1);
      matcher.matches();
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      None found at thiss time.

            sherman Xueming Shen
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: