From 8dca103a506408fad7c147b432a0c757c43ecc8b Mon Sep 17 00:00:00 2001 From: Naoto Sato Date: Fri, 20 Dec 2024 13:02:00 -0800 Subject: [PATCH] Fixed compile error --- src/java.base/share/classes/java/time/ZoneOffset.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/java.base/share/classes/java/time/ZoneOffset.java b/src/java.base/share/classes/java/time/ZoneOffset.java index b35979133103a..520a0e0b9a194 100644 --- a/src/java.base/share/classes/java/time/ZoneOffset.java +++ b/src/java.base/share/classes/java/time/ZoneOffset.java @@ -429,7 +429,9 @@ public static ZoneOffset ofTotalSeconds(int totalSeconds) { if (result == null) { result = new ZoneOffset(totalSeconds); var existing = SECONDS_CACHE.putIfAbsent(totalSecs, result); - return (existing != null) ? existing : result; + if (existing != null) { + result = existing; + } ID_CACHE.putIfAbsent(result.getId(), result); } return result;