From a224f12cb701b45df4706a403a05c66de2d623af Mon Sep 17 00:00:00 2001 From: Justin Lu Date: Tue, 28 Jan 2025 17:40:20 +0000 Subject: [PATCH] 8348205: Improve cutover time selection when building available currencies set Reviewed-by: naoto, rriggs --- src/java.base/share/classes/java/util/Currency.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/java.base/share/classes/java/util/Currency.java b/src/java.base/share/classes/java/util/Currency.java index 789eefad5d5..9f8b94acbd7 100644 --- a/src/java.base/share/classes/java/util/Currency.java +++ b/src/java.base/share/classes/java/util/Currency.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -444,8 +444,8 @@ public final class Currency implements Serializable { public static Set getAvailableCurrencies() { synchronized(Currency.class) { if (available == null) { + var sysTime = System.currentTimeMillis(); available = new HashSet<>(256); - // Add simple currencies first for (char c1 = 'A'; c1 <= 'Z'; c1 ++) { for (char c2 = 'A'; c2 <= 'Z'; c2 ++) { @@ -467,7 +467,7 @@ public final class Currency implements Serializable { SpecialCaseEntry scEntry = specialCasesList.get(index); if (scEntry.cutOverTime == Long.MAX_VALUE - || System.currentTimeMillis() < scEntry.cutOverTime) { + || sysTime < scEntry.cutOverTime) { available.add(getInstance(scEntry.oldCurrency, scEntry.oldCurrencyFraction, scEntry.oldCurrencyNumericCode));