RFR 8015594: java.util.Pattern.matcher function throws a NullPointerException

Alan Bateman Alan.Bateman at oracle.com
Tue Apr 26 12:26:22 UTC 2016



On 26/04/2016 12:49, Sergey Ustimenko wrote:
> Hi all!
>
> There is a bug described at https://bugs.openjdk.java.net/browse/JDK-8015594
>
> The problem is that if we are using java.util.Pattern.matcher with NULL
> argument,
> then the NPE will be thrown. As Stuart Marks has noticed in the comments,
> that such
> behavior have not been specified
The package description has this

  * <p> Unless otherwise noted, passing a <code>null</code> argument to a
  * method in any class or interface in this package will cause a
  * {@link java.lang.NullPointerException NullPointerException} to be
  * thrown.

and so avoids needing to specifying it on every method.

-Alan



More information about the core-libs-dev mailing list