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 <ol...@apache.org> on 2008/12/01 00:59:41 UTC

Re: Returning null instead of empty array

On Mon, 2008-12-01 at 12:54 +0000, sebb wrote:
> Various HttpClient methods currently return null instead of an array
> under some circumstances.
> 
> This means that the calling code has to check for null before
> processing the result, whereas in most cases the code would work just
> as well if there was an empty array, thus saving the null check.
> 
> For example:
> private String[] org.apache.http.conn.ssl.AbstractVerifier.getSubjectAlts()
> 
> int[] org.apache.http.impl.cookie.BasicClientCookie.getPorts()
> 
> Any thoughts on this?
> 

This is obviously wrong and should be fixed. 

Oleg 

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


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


Re: Returning null instead of empty array

Posted by sebb <se...@gmail.com>.
On 30/11/2008, Oleg Kalnichevski <ol...@apache.org> wrote:
> On Mon, 2008-12-01 at 12:54 +0000, sebb wrote:
>  > Various HttpClient methods currently return null instead of an array
>  > under some circumstances.
>  >
>  > This means that the calling code has to check for null before
>  > processing the result, whereas in most cases the code would work just
>  > as well if there was an empty array, thus saving the null check.
>  >
>  > For example:
>  > private String[] org.apache.http.conn.ssl.AbstractVerifier.getSubjectAlts()
>  >
>  > int[] org.apache.http.impl.cookie.BasicClientCookie.getPorts()
>  >
>  > Any thoughts on this?
>  >
>
>
> This is obviously wrong and should be fixed.

OK, I'm happy to do it.

It will slightly change the behaviour for some public methods.

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

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