Skip to content

Commit

Permalink
removed <=0 check for ownerID
Browse files Browse the repository at this point in the history
  • Loading branch information
bijomutta committed Jul 14, 2023
1 parent 07dd88f commit 2b6a4ff
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ public Collection<PetType> populatePetTypes() {
@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);
Expand All @@ -70,9 +68,7 @@ public Owner findOwner(@PathVariable("ownerId") int ownerId) {
@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);
Expand Down

0 comments on commit 2b6a4ff

Please sign in to comment.