WW-4360: Fix a few NullPointerExceptions identified by Eclipse

Eclipse's static analysis of nulls identifies a number of spots where a `NullPointerException` can occur. This change fixes them either to rearrange things so they can't happen or to throw a more specific exception.
I prefer extending `Logger` interface and define new method: `void error(String msg, Object... args);` the same as I already did for `debug` and `trace`. Thus will allow reduce `ObjectUtils` dependency and give new functionality :-)

This can be handled with dedicated PR