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