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:58:47 UTC

Re: EntityUtils does not throw ParseException

On Mon, 2008-12-01 at 12:29 +0000, sebb wrote:
> I just added some Javadoc for EntityUtils, and noticed that:
> 
>    org.apache.http.util.EntityUtils.getContentCharSet(HttpEntity entity)
> 
> says it throws ParseException - however, that does not appear to be possible.
> 
> Should the throws clause be removed from it and its callers?
> 

Hi Sebastian,

ParseException can occur while tokenizing header value into separate
header elements in the Header#getElements() method. I think the method
declaration is correct. 

However, it just occurred to me that it should have been rethrown as as
a checked protocol exception in the Header#getElements() method. 

Damn.

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: EntityUtils does not throw ParseException

Posted by sebb <se...@gmail.com>.
On 30/11/2008, Oleg Kalnichevski <ol...@apache.org> wrote:
> On Mon, 2008-12-01 at 12:29 +0000, sebb wrote:
>  > I just added some Javadoc for EntityUtils, and noticed that:
>  >
>  >    org.apache.http.util.EntityUtils.getContentCharSet(HttpEntity entity)
>  >
>  > says it throws ParseException - however, that does not appear to be possible.
>  >
>  > Should the throws clause be removed from it and its callers?
>  >
>
>
> Hi Sebastian,
>
>  ParseException can occur while tokenizing header value into separate
>  header elements in the Header#getElements() method. I think the method
>  declaration is correct.

Oops - yes, I missed that ...

>  However, it just occurred to me that it should have been rethrown as as
>  a checked protocol exception in the Header#getElements() method.

... mainly because it is an unchecked Exception.

>  Damn.

I've updated the EntityUtils Javadoc.

>  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