A DESCRIPTION OF THE PROBLEM :
DateFormatSymbols(locale) doesn't check for null, causing an NPE when finding a null key in a map.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
MissingResourceException – if the resources for the specified locale cannot be found or cannot be loaded.
ACTUAL -
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "Object.hashCode()" because "key" is null
at java.base/java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:948)
at java.base/java.text.DateFormatSymbols.initializeData(DateFormatSymbols.java:725)
at java.base/java.text.DateFormatSymbols.<init>(DateFormatSymbols.java:151)
---------- BEGIN SOURCE ----------
public static void main(String[] args)
{
DateFormatSymbols defaultSymbols = new DateFormatSymbols(null);
}
---------- END SOURCE ----------
DateFormatSymbols(locale) doesn't check for null, causing an NPE when finding a null key in a map.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
MissingResourceException – if the resources for the specified locale cannot be found or cannot be loaded.
ACTUAL -
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "Object.hashCode()" because "key" is null
at java.base/java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:948)
at java.base/java.text.DateFormatSymbols.initializeData(DateFormatSymbols.java:725)
at java.base/java.text.DateFormatSymbols.<init>(DateFormatSymbols.java:151)
---------- BEGIN SOURCE ----------
public static void main(String[] args)
{
DateFormatSymbols defaultSymbols = new DateFormatSymbols(null);
}
---------- END SOURCE ----------
- csr for
-
JDK-8366735 Refine null locale processing of ctor/factory methods in `Date/DecimalFormatSymbols`
-
- Closed
-
- links to
-
Commit(master) openjdk/jdk/3824c7cd
-
Review(master) openjdk/jdk/27060