You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Oleg Kalnichevski (Jira)" <ji...@apache.org> on 2021/06/13 09:53:00 UTC

[jira] [Commented] (HTTPCORE-681) Inconsistent behavior between WWWFormCodec and URLEncodedUtils for null input

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

Oleg Kalnichevski commented on HTTPCORE-681:
--------------------------------------------

[~slisaasquatch] I personally think the new behavior (returning null for null) is more logical.

Oleg  

> Inconsistent behavior between WWWFormCodec and URLEncodedUtils for null input
> -----------------------------------------------------------------------------
>
>                 Key: HTTPCORE-681
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-681
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore
>    Affects Versions: 5.1
>            Reporter: Siqi Li
>            Priority: Trivial
>
> Simple code example:
> {code:java}
> public static void main(String[] args) {
> 	System.out.println(URLEncodedUtils.parse((String) null, StandardCharsets.UTF_8)); // []
> 	System.out.println(WWWFormCodec.parse((String) null, StandardCharsets.UTF_8)); // null
> }
> {code}
>  
>  Basically when the input String is null, URLEncodedUtils.parse returns an empty list and WWWFormCodec.parse returns null. It's by no means a big deal, but it did catch me off guard, because I expected WWWFormCodec to be a drop-in replacement. If this was intended, then please disregard this issue.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org