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

JavaDoc summary of regular-expression construct is insufficient

XMLWordPrintable

      FULL PRODUCT VERSION :
      Java™ Platform
      Standard Ed. 8

      ADDITIONAL OS VERSION INFORMATION :
      Linux krzzel-840 3.13.0-57-generic #95-Ubuntu SMP Fri Jun 19 09:28:15 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      The Summary of regular-expression constructs for class java .util .regex .Pattern is wrong. It says:

      Construct Matches
       
      Characters
      _x_ The character _x_

      (While this is true if taken literally, _x_ is meant to be a place-holder). This does not hold when _x_ is a special characters like the inverse solidus \.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Visit <URL: http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html >

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Any character in the pattern string matches itself except for the following meta-characters: inverse solidus \, parentheses (), brackets [], dot ., question mark ?, asterisk *, and for characters within special inserts as described below.
      ACTUAL -
      x The character x

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "main" java.util.regex.PatternSyntaxException: Dangling meta character '*' near index 0
      *
      ^


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.util.regex.Pattern;
      class PatternTest
      {
      public final static void main (String [] args)
      { final String p = "*"; System .exit (Pattern .compile (p) .matcher (p) .matches ()? 0 : 01); }}
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Copy and edit the documentation page yourself.

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: