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

Javadoc for Scanner.next(Pattern) is inconsistent with Scanner.next(String)

XMLWordPrintable

    • b59
    • sparc
    • solaris_8



      Name: jl125535 Date: 07/13/2004


      URL OF FAULTY DOCUMENTATION :
      http://java.sun.com/j2se/1.5.0/docs/api/java/util/Scanner.html#next(java.util.regex.Pattern)

      A DESCRIPTION OF THE PROBLEM :
      The documentation for Scanner.next (Pattern) reads, in part:

         "Returns the next string in the input that matches the specified pattern...."

      while that of Scanner.next (String) reads:

         "Returns the next token if it matches the pattern constructed from the specified string. ...

          An invocation of this method of the form next(pattern) behaves in exactly the
         same way as the invocation next(Pattern.compile(pattern)). "

      The first sentences of these method descriptions are contradictory, because the phrasing does not match exactly.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
       For Scanner.next(Pattern):

          "Returns the next token if it matches the specified pattern...."

      [ to match the phrasing of Scanner.next(String) ]

      ACTUAL -
      See the detailed description.
      (Incident Review ID: 285248)
      ======================================================================

            mmcclosksunw Michael Mccloskey (Inactive)
            jleesunw Jon Lee (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: