RFR: 8299865: Unnecessary NullPointerException catch in java.util.TimeZone#setDefaultZone
Justin Lu
duke at openjdk.org
Thu Jan 12 19:23:15 UTC 2023
On Wed, 11 Jan 2023 17:34:13 GMT, Naoto Sato <naoto at openjdk.org> wrote:
>> In [JDK-4368016](https://bugs.openjdk.org/browse/JDK-4368016) **TimeZone.setDefaultZone()** was updated so that
>>
>> _TimeZone.java [will] not cause an NPE. If getSystemTimeZoneID()
>> can't determine the time zone from java.home and user.region properties,
>> it returns GMT._
>>
>> This change updates the code to get rid of the no longer needed Try Catch
>
> src/java.base/share/classes/java/util/TimeZone.java line 678:
>
>> 676: if (zoneID == null || zoneID.isEmpty()) {
>> 677: String javaHome = StaticProperty.javaHome();
>> 678: zoneID = getSystemTimeZoneID(javaHome);
>
> Nit: align the indentation. Also, `javaHome` variable can be eliminated.
Thanks for catching that, fixed
-------------
PR: https://git.openjdk.org/jdk/pull/11951
More information about the core-libs-dev
mailing list