8299865: Unnecessary NullPointerException catch in java.util.TimeZone#setDefaultZone

Reviewed-by: lancea, iris, naoto, aturbanov
This commit is contained in:
Justin Lu 2023-01-13 18:13:50 +00:00 committed by Naoto Sato
parent 4ec3659845
commit 500b45e12d

@ -674,13 +674,8 @@ public abstract class TimeZone implements Serializable, Cloneable {
// if the time zone ID is not set (yet), perform the
// platform to Java time zone ID mapping.
if (zoneID == null || zoneID.isEmpty()) {
String javaHome = StaticProperty.javaHome();
try {
zoneID = getSystemTimeZoneID(javaHome);
if (zoneID == null) {
zoneID = GMT_ID;
}
} catch (NullPointerException e) {
zoneID = getSystemTimeZoneID(StaticProperty.javaHome());
if (zoneID == null) {
zoneID = GMT_ID;
}
}