BrokenNullCheck
843785Jul 11 2008 — edited Jul 11 2008HttpSession session = request.getSession();
String wfmsId = request.getParameter("wfmsId");
if(wfmsId == null && wfmsId.trim().equals(""))
{
session.removeAttribute("wfmsID");
}
else
{
session.setAttribute("wfmsID",wfmsId);
}
when i do the code review (using PMD tool) it shows the below description as:
The null check is broken since it will throw a Nullpointer itself.
The reason is that a method is called on the object when it is null.
It is likely that you used || instead of && or vice versa.
please suggest me.
Thanks