java.util.Pattern.matcher function throws a NullPointerException

XMLWordPrintable

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

      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 ----------

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

              Created:
              Updated:
              Resolved: