From cd6f33c03e2e9de06888f47988a56ec090207fd2 Mon Sep 17 00:00:00 2001 From: Seongguk Jeong Date: Sun, 9 Jul 2023 23:53:00 +0900 Subject: [PATCH] Using putIfAbsent instead of put --- .../annotation/web/builders/FilterOrderRegistration.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/builders/FilterOrderRegistration.java b/config/src/main/java/org/springframework/security/config/annotation/web/builders/FilterOrderRegistration.java index cddb6ce5e4..09d9766f11 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/builders/FilterOrderRegistration.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/builders/FilterOrderRegistration.java @@ -127,11 +127,7 @@ final class FilterOrderRegistration { * @param position the position to associate with the {@link Filter} */ void put(Class filter, int position) { - String className = filter.getName(); - if (this.filterToOrder.containsKey(className)) { - return; - } - this.filterToOrder.put(className, position); + this.filterToOrder.putIfAbsent(filter.getName(), position); } /**