MessageSourceResourceBundle.containsKey throws NullPointerException [SPR-10136] #14769
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: backported
An issue that has been backported to maintenance branches
type: bug
A general bug
Milestone
Adrien Bonnin opened SPR-10136 and commented
When I try to use containsKey method on a MessageSourceResourceBundle instance I got the following NullPointerException :
Exception in thread "main" java.lang.NullPointerException
at java.util.ResourceBundle.handleKeySet(ResourceBundle.java:1787)
at java.util.ResourceBundle.containsKey(ResourceBundle.java:1741)
at net.toto.main(Main.java:36)
Here is a sample code :
Locale locale = Locale.getDefault();
ResourceBundleMessageSource bundle = new ResourceBundleMessageSource();
bundle.setBasename("bundles.Main");
System.out.println(bundle.getMessage("settings", new Object[0], locale));
MessageSourceResourceBundle bundle2 = new MessageSourceResourceBundle(bundle, locale);
System.out.println(bundle2.getString("settings"));
bundle2.containsKey("settings"); // NullPointerException
Affects: 3.1.2
Backported to: 3.1.4
The text was updated successfully, but these errors were encountered: