mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-22 07:15:49 +00:00
Adds NPE
This commit is contained in:
parent
798cccfb37
commit
d1a3b41617
1 changed files with 3 additions and 2 deletions
|
@ -84,12 +84,13 @@ class OwnerController {
|
|||
@GetMapping("/owners")
|
||||
public String processFindForm(Owner owner, BindingResult result, Map<String, Object> model) {
|
||||
|
||||
System.out.println("***" + owner.getLastName());
|
||||
// allow parameterless GET request for /owners to return all records
|
||||
if (owner.getLastName() == null) {
|
||||
owner.setLastName(""); // empty string signifies broadest possible search
|
||||
}
|
||||
|
||||
System.out.println("Searching for " + owner.getLastName().trim());
|
||||
|
||||
// find owners by last name
|
||||
Collection<Owner> results = this.owners.findByLastName(owner.getLastName());
|
||||
if (results.isEmpty()) {
|
||||
|
|
Loading…
Reference in a new issue