[seam-issues] [JBoss JIRA] Commented: (SEAMINTL-32) NPEs in ApplicationBundles.put*

Nicklas Karlsson (JIRA) jira-events at lists.jboss.org
Fri Mar 11 16:44:48 EST 2011


    [ https://issues.jboss.org/browse/SEAMINTL-32?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12587507#comment-12587507 ] 

Nicklas Karlsson commented on SEAMINTL-32:
------------------------------------------

Actually, most methods need a check for the nesting, should bundles.get(locale) return null:

   public void clear(final Locale locale)
   public boolean containsKey(final Locale locale, final Object key)
   public boolean containsValue(final Locale locale, final Object value)
   public Set<java.util.Map.Entry<String, ResourceBundle>> entrySet(final Locale locale)
   public boolean isEmpty(final Locale locale)
   public Set<String> keySet(final Locale locale)
   public ResourceBundle put(final Locale locale, final String key, final ResourceBundle value)
   public void putAll(final Locale locale, final Map<? extends String, ? extends ResourceBundle> m)
   public ResourceBundle remove(final Locale locale, final Object key)
   public int size(final Locale locale)
   public Collection<ResourceBundle> values(final Locale locale)


> NPEs in ApplicationBundles.put*
> -------------------------------
>
>                 Key: SEAMINTL-32
>                 URL: https://issues.jboss.org/browse/SEAMINTL-32
>             Project: Seam International
>          Issue Type: Bug
>          Components: Messages
>    Affects Versions: 3.0.0.Final
>            Reporter: Nicklas Karlsson
>            Assignee: Ken Finnigan
>
> If you put something in the bundles with a locale for the first time, bundles.get(locale) is null and we get a NPE.
>    public ResourceBundle put(final Locale locale, final String key, final ResourceBundle value)
>    {
>       return bundles.get(locale).put(key, value);
>    }
>    public void putAll(final Locale locale, final Map<? extends String, ? extends ResourceBundle> m)
>    {
>       bundles.get(locale).putAll(m);
>    }
> Nested map access need a if(!bundles.containsKey(locale)) + map init

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the seam-issues mailing list