java.lang.nullpointerexception cannot invoke object.getclass() because value is null