Skip to content

Commit

Permalink
Fix possible null argument warning
Browse files Browse the repository at this point in the history
  • Loading branch information
glts committed Apr 2, 2016
1 parent a41abc6 commit 9f68177
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ public String initCreationForm(Owner owner, ModelMap model) {

@RequestMapping(value = "/pets/new", method = RequestMethod.POST)
public String processCreationForm(Owner owner, @Valid Pet pet, BindingResult result, ModelMap model) {
if (StringUtils.hasLength(pet.getName()) && pet.isNew() && owner.getPet(pet.getName(), true) != null){
String petName = pet.getName();
if (StringUtils.hasLength(petName) && pet.isNew() && owner.getPet(petName, true) != null) {
result.rejectValue("name", "duplicate", "already exists");
}
if (result.hasErrors()) {
Expand Down

0 comments on commit 9f68177

Please sign in to comment.