StringUtils methods are null safe. You can leave away everything in front of StringUtils.contains.