[jira] [Commented] (OFBIZ-11281) Possible Nullpointer in StringUtil#strToMap

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-11281) Possible Nullpointer in StringUtil#strToMap

Nicolas Malin (Jira)

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

Nicolas Malin commented on OFBIZ-11281:
---------------------------------------

Thanks Mathieu for this return,

I analyzed a little more in depth different method of StringUtil dans I think we can refactorize for more coherence because functions toSet and toList throw an exception when it's impossible to generate the related Object or strToMap return null.

To offer more flexibility and coherence, I'd be tempted to reformate like that :
 * toSet, toList and toMap (will rename strToMap) will throw an exception if it can parse the String
 * safeToSet, safeToList and safeToMap (or other idea on name) will return null or empty object (we can adding a boolean in parameter to select) if the parse failed

> Possible Nullpointer in StringUtil#strToMap
> -------------------------------------------
>
>                 Key: OFBIZ-11281
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-11281
>             Project: OFBiz
>          Issue Type: Bug
>    Affects Versions: Trunk
>            Reporter: Ulrich Heidfeld
>            Assignee: Nicolas Malin
>            Priority: Critical
>             Fix For: 17.12.01, Upcoming Branch, 18.12.01
>
>         Attachments: OFBIZ-11281_Possible_Nullpointer_in_StringUtil#strToMap.patch
>
>
> StringUtil#strToMap(String, String, boolean, String) throws Nullpointer for StringUtil.strToMap("", false).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)