The problem is your assessment in java, it should be:
if(status == null||status.equals("")) { //Do not try to dereference status....
It should be noted that this only works because Java and other languages ββcan reduce logical grades. In this case, some simple Boolean algebra:
true || ??? => true
Once the first term evaluates to true, we know that the conditional OR will also evaluate to true, there is no need to study the second term.
Alternatively, you can use Apache Commons isEmpty() or collapse your own:
public static final boolean isEmpty(String arg0) { if(arg0 == null) return true; if(arg0.trim().length() < 1) return true; return false; }
The featured version is akin to isBlank in Apache Commons.
source share