hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Kalnichevski (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HTTPCLIENT-1274) NullPointerException on 304 Not Modified response
Date Wed, 12 Dec 2012 19:48:20 GMT

     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1274?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Oleg Kalnichevski updated HTTPCLIENT-1274:
------------------------------------------

         Priority: Major  (was: Minor)
    Fix Version/s: 4.2.3

The 304 response messages MUST NOT contain a message-body, so this is a major bug. The response
object should not have an entity at all.

Oleg
                
> NullPointerException on 304 Not Modified response
> -------------------------------------------------
>
>                 Key: HTTPCLIENT-1274
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1274
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache
>    Affects Versions: Snapshot
>            Reporter: Francois-Xavier Bonnet
>             Fix For: 4.2.3
>
>         Attachments: TestCachingExec.patch.txt
>
>
> When sending a conditional request (If-None-Match for example) and the backend responds
with a 304 Not Modified, the response contains an HttpEntity but you get a NullPointerException
whenever to try to call one of the methods :
> - org.apache.http.HttpEntity.getContent()
> - org.apache.http.HttpEntity.writeTo(OutputStream)
> I would expect getEntity() to return null if there is no entity in the response.
> As a workaround I can test on the contentLength before calling these methods and call
EntityUtils.consume(entity) to get sure that the connection is released but this makes things
more complicated.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


Mime
View raw message