Skip to content

Commit a224f12

Browse files
author
Justin Lu
committed
8348205: Improve cutover time selection when building available currencies set
Reviewed-by: naoto, rriggs
1 parent 8103256 commit a224f12

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/java.base/share/classes/java/util/Currency.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -444,8 +444,8 @@ public static Currency getInstance(Locale locale) {
444444
public static Set<Currency> getAvailableCurrencies() {
445445
synchronized(Currency.class) {
446446
if (available == null) {
447+
var sysTime = System.currentTimeMillis();
447448
available = new HashSet<>(256);
448-
449449
// Add simple currencies first
450450
for (char c1 = 'A'; c1 <= 'Z'; c1 ++) {
451451
for (char c2 = 'A'; c2 <= 'Z'; c2 ++) {
@@ -467,7 +467,7 @@ public static Set<Currency> getAvailableCurrencies() {
467467
SpecialCaseEntry scEntry = specialCasesList.get(index);
468468

469469
if (scEntry.cutOverTime == Long.MAX_VALUE
470-
|| System.currentTimeMillis() < scEntry.cutOverTime) {
470+
|| sysTime < scEntry.cutOverTime) {
471471
available.add(getInstance(scEntry.oldCurrency,
472472
scEntry.oldCurrencyFraction,
473473
scEntry.oldCurrencyNumericCode));

0 commit comments

Comments
 (0)