Your isEmpty test is just doing things in the wrong order. Change this:
if (HREF.equals("") || HREF.equals("null") || HREF == null || HREF.isEmpty())
return true;
to:
if (HREF == null || HREF.equals("") || HREF.equals("null") || HREF.isEmpty())
return true;
If HREF is actually null, then the first test will short-circuit the rest of the if and you won't get a NPE.
(By the way, explicitly testing HREF.equals("") and also calling HREF.isEmpty() is redundant. You only need to do one or the other.)
By the by-the-way, I would recommend, as a matter of style simplifying your method to a single return statement:
public boolean isEmpty(String HREF){
return HREF == null || HREF.isEmpty()) || HREF.equals("null");
}
(Also, if testing against the string "null" was an attempt to check against a null value, you can drop that condition as well. In fact, you could then use something like Apache Commons' StringUtils.isEmpty(CharSequence) method to do what you want.)
java boolean operator short circuit, and then see why we recommend that the null check be done first. Note that @digidude is incorrect -- you do not surround null with quotes. It'sif (HREF == null || ...)