8342550: Log warning for using JDK1.1 compatible time zone IDs for future removal

Reviewed-by: jlu, joehw, iris
This commit is contained in:
Naoto Sato 2025-01-15 17:15:05 +00:00
parent 983e24fd26
commit cfe70ebcb3
3 changed files with 61 additions and 5 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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
@ -46,6 +46,7 @@ import jdk.internal.util.StaticProperty;
import sun.util.calendar.ZoneInfo;
import sun.util.calendar.ZoneInfoFile;
import sun.util.locale.provider.TimeZoneNameUtility;
import sun.util.logging.PlatformLogger;
/**
* {@code TimeZone} represents a time zone offset, and also figures out daylight
@ -596,6 +597,11 @@ public abstract class TimeZone implements Serializable, Cloneable {
}
private static TimeZone getTimeZone(String ID, boolean fallback) {
if (ZoneId.SHORT_IDS.containsKey(ID)) {
PlatformLogger.getLogger(TimeZone.class.getName())
.warning("Use of the three-letter time zone ID \"%s\" is deprecated and it will be removed in a future release"
.formatted(ID));
}
TimeZone tz = ZoneInfo.getTimeZone(ID);
if (tz == null) {
tz = parseCustomTimeZone(ID);