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

java.util.Pattern.matcher function throws a NullPointerException

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 7
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:

      Description

      A DESCRIPTION OF THE REQUEST :
      java.util.Pattern.matcher function throws a NullPointerException if the argument is NULL.

      JUSTIFICATION :
      This functions shouldn't throw NPE, just do its work as the argument is a text that doesn't matches...

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The works of this function should be the same as if the argument is a text that doesn't matches with the pattern
      ACTUAL -
      NullPointerException

      ---------- BEGIN SOURCE ----------
      private final static String REGEXP_TEST_EMAIL = " ^blabla(\\.)?(ui)?test(\\.)?(child|teen|adult)?[0-9]*(\\+)?[a-zA-Z0-9]*@gmail.com " ;
      private static Pattern emailPattern = Pattern.compile(REGEXP_TEST_EMAIL);

      String email = null;
      Matcher matcher = emailPattern.matcher(emailAddress);
      ---------- END SOURCE ----------

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: