hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roland Weber (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HTTPCORE-139) allow explicit unsetting of parameters in stacks or hierarchies
Date Mon, 04 Feb 2008 01:17:07 GMT

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

Roland Weber commented on HTTPCORE-139:
---------------------------------------

There are now testcases for the parameter-specific solution in HttpClient. Please have a look
at TestRouteParams.testUnsetHierarchy, it should make obvious why getParameter cannot be allowed
to map NULL objects to null. Hierarchy traversal needs to be stopped on the first object found,
whether that is NULL or a real value. It must not be resumed in wrapping instances of HttpParams.

The reasons why #getParameter needs to behave differently from the typed siblings are:
- typed siblings cannot return an explicit NULL object
- typed siblings are called on the outmost level only, while getParameter is used to traverse
hierarchies

NULL checks need to be spread everywhere you currently have null checks. I prefer to have
these once in AbstractHttpParams for the default types, instead of spreading them throughout
the modules and application code.

as a side note:
The typed getters for elementary types are not required to map to getParameter. Since they
get the default as argument and don't return null, they can traverse a hierarchy by calling
their counterpart in parents/defaults too. The only getter that needs to map to getParameter
is getString. It can return null to indicate it is unset, but it cannot return a NULL object
nor does it get a default to pass in traversal calls. The latter wouldn't help anyway, because
the default could be null too.

cheers,
  Roland


> allow explicit unsetting of parameters in stacks or hierarchies
> ---------------------------------------------------------------
>
>                 Key: HTTPCORE-139
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-139
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>    Affects Versions: 4.0-alpha6
>            Reporter: Roland Weber
>            Assignee: Roland Weber
>            Priority: Minor
>             Fix For: 4.0-beta2
>
>         Attachments: 2k8-01-10-null-param.txt, 2k8-01-13-null-param.txt
>
>
> Patch for the "global null" approach to follow.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


Mime
View raw message