removed <=0 check for ownerID

This commit is contained in:
bijomutta 2023-07-14 11:03:49 +02:00
parent 07dd88f9f7
commit 2b6a4ff434

View file

@ -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);