Hello friends am trying to work on resolving NUllpointer Exception that is being thrown with in this code
public String getInvalidPhoneNumberNotification() {
List<String> errors = getValidationErrors();
String search = "valid phone number";
for (String str : errors) {
if (str.trim().contains(search))
return str;
}
return null;
}
i have read through different ways of how i can get rid of using return null object in order to catch npe but it seems the problem still persits, am using getInvalidPhoneNumberNotification() method reference to handle whether the method is an integer, but the problem is returning null object when its already null, any help will be appreciated