You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Thomas Neidhart (JIRA)" <ji...@apache.org> on 2014/04/10 22:40:18 UTC

[jira] [Commented] (COLLECTIONS-516) NullPointerException in MapUtils.toProperties

    [ https://issues.apache.org/jira/browse/COLLECTIONS-516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13965813#comment-13965813 ] 

Thomas Neidhart commented on COLLECTIONS-516:
---------------------------------------------

The javadoc comment refers to the case when the provided map is null, not individual entries within the map.

We could add a check to prevent adding null keys to the Properties object, but I think this would just hide wrong usage, so I would prefer to add additional clarification to the javadoc that null keys / values will result in a NullPointerException.

> NullPointerException in MapUtils.toProperties
> ---------------------------------------------
>
>                 Key: COLLECTIONS-516
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-516
>             Project: Commons Collections
>          Issue Type: Bug
>          Components: Collection
>    Affects Versions: 4.0
>         Environment: Mac OS 10.9, Java 6
>            Reporter: Cyrille Artho
>         Attachments: Report4.java
>
>
> calling MapUtils.toProperties with a map having null entries results in a NullPointerException. In this case the Map has only entry <null, null>.
> However, javadoc states "A null input will return an empty
> properties object." so (1) this should be clarified as it would
> only apply to the map reference itself, not its contents, or (2)
> an empty property object should be generated for null entries in
> the map as well.



--
This message was sent by Atlassian JIRA
(v6.2#6252)