JDK-8050216 : java.util.regex.Pattern.matcher(null) is to be specified as NullPointerException
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.regex
  • Affected Version: 7
  • Priority: P4
  • Status: Resolved
  • Resolution: Duplicate
  • OS: generic
  • Submitted: 2013-03-12
  • Updated: 2014-12-03
  • Resolved: 2014-12-03
Related Reports
Duplicate :  
Description
A DESCRIPTION OF THE PROBLEM :
The API document is not mentioning the case that java.utl.regex.Pattern.matcher(input) gets the argument input = null, and the description can be read that the method 'matcher' never raises exceptions. However jre provided by Oracle raises NullPointerException for the case.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
  To be added the 'Throws' paragraph to the 'matcher's description, and be described about the case if input is null.
ACTUAL -
Nothing about the exception is written.

URL OF FAULTY DOCUMENTATION :
http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#matcher(java.lang.CharSequence)
Comments
6178785
03-12-2014

The regex package.html has a "standard" null behavior description "Unless otherwise noted, passing a null argument to a constructor or method in any class or interface in this package will cause a NullPointerException to be thrown." This was added via 6178785
14-07-2014