java: add extra check that animal is set