mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-23 16:25:49 +00:00
removed <=0 check for ownerID
This commit is contained in:
parent
07dd88f9f7
commit
2b6a4ff434
1 changed files with 2 additions and 6 deletions
|
@ -57,9 +57,7 @@ class PetController {
|
|||
@ModelAttribute("owner")
|
||||
public Owner findOwner(@PathVariable("ownerId") int ownerId) {
|
||||
|
||||
if (ownerId <= 0) {
|
||||
throw new IllegalArgumentException("Owner ID is required");
|
||||
}
|
||||
|
||||
Owner owner = this.owners.findById(ownerId);
|
||||
if (owner == null) {
|
||||
throw new IllegalArgumentException("Owner ID not found: " + ownerId);
|
||||
|
@ -70,9 +68,7 @@ class PetController {
|
|||
@ModelAttribute("pet")
|
||||
public Pet findPet(@PathVariable("ownerId") int ownerId,
|
||||
@PathVariable(name = "petId", required = false) Integer petId) {
|
||||
if (ownerId <= 0) {
|
||||
throw new IllegalArgumentException("Owner ID is required");
|
||||
}
|
||||
|
||||
Owner owner = this.owners.findById(ownerId);
|
||||
if (owner == null) {
|
||||
throw new IllegalArgumentException("Owner ID not found: " + ownerId);
|
||||
|
|
Loading…
Reference in a new issue