From df938fa402e08f90f830a4eb409dab4c1b91599a Mon Sep 17 00:00:00 2001 From: nidhi-vm Date: Thu, 19 Jun 2025 15:31:19 -0400 Subject: [PATCH] Updating using GitHub API 2025-06-19-15:31 --- .../springframework/samples/petclinic/owner/Owner.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/springframework/samples/petclinic/owner/Owner.java b/src/main/java/org/springframework/samples/petclinic/owner/Owner.java index c5ae067dc..f6a0f363b 100644 --- a/src/main/java/org/springframework/samples/petclinic/owner/Owner.java +++ b/src/main/java/org/springframework/samples/petclinic/owner/Owner.java @@ -134,10 +134,8 @@ public class Owner extends Person { public Pet getPet(String name, boolean ignoreNew) { for (Pet pet : getPets()) { String compName = pet.getName(); - if (compName != null && compName.equalsIgnoreCase(name)) { - if (!ignoreNew || !pet.isNew()) { - return pet; - } + if (compName != null && compName.equalsIgnoreCase(name) && (!ignoreNew || !pet.isNew())) { + return pet; } } return null; @@ -172,4 +170,4 @@ public class Owner extends Person { pet.addVisit(visit); } -} +} \ No newline at end of file