On Fri, 29 Apr 2022 20:45:20 GMT, Andrey Turbanov <aturba...@openjdk.org> wrote:

>> src/java.base/share/classes/java/time/format/ZoneName.java.template line 60:
>> 
>>> 58: 
>>> 59:     public static String toZid(String zid) {
>>> 60:         return aliases.getOrDefault(zid, zid);
>> 
>> Is the behavior if zid == null the same?  aliases.getOrDefault will throw 
>> NPE on null.
>> neither Hashmap.containsKey or .get throw on null.
>
>>aliases.getOrDefault will throw NPE on null
> 
> No, It will not. `aliases` is a HashMap. And HashMap supports null values and 
> keys.

Anyway, this method is used only in `DateTimeFormatterBuilder` and it doesn't 
pass `null` value there.

-------------

PR: https://git.openjdk.java.net/jdk/pull/8463

Reply via email to