[
https://issues.apache.org/jira/browse/HTTPCLIENT-1287?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13541935#comment-13541935
]
Noah Levitt commented on HTTPCLIENT-1287:
-----------------------------------------
> I committed the patch to SVN trunk.
Thanks!
> However, I have to say ConnectionShutdownException is perfectly normal and
> should be expected if a request is aborted while in the process of being
> executed.
Well, the response object is still useful, and you lose it if an exception is
thrown. The exception was happening in the case where we call request.abort()
after reading the http headers and before reading the message body. We have
other test cases that abort in the midst of reading the body (tho I don't know
for sure if that's the decisive difference) and in those cases no exceptions
were thrown, so that was my expectation here as well.
> DefaultUserTokenHandler.getUserToken() throws ConnectionShutdownException
> after certain aborted fetches
> -------------------------------------------------------------------------------------------------------
>
> Key: HTTPCLIENT-1287
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1287
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Affects Versions: 4.3 Alpha1
> Reporter: Noah Levitt
>
> DefaultUserTokenHandler.getUserToken() throws ConnectionShutdownException
> after certain aborted fetches, resulting in this:
> java.io.InterruptedIOException: Connection has been shut down
> at
> org.apache.http.impl.client.execchain.MainClientExec.execute(MainClientExec.java:322)
> at
> org.apache.http.impl.client.execchain.ProtocolExec.execute(ProtocolExec.java:170)
> at
> org.apache.http.impl.client.execchain.RetryExec.execute(RetryExec.java:77)
> at
> org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
> at
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:69)
> at
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:1)
> [...]
> Caused by: org.apache.http.impl.conn.ConnectionShutdownException
> at org.apache.http.impl.conn.CPoolProxy.invoke(CPoolProxy.java:121)
> at $Proxy0.getSSLSession(Unknown Source)
> at
> org.apache.http.impl.client.DefaultUserTokenHandler.getUserToken(DefaultUserTokenHandler.java:81)
> at
> org.apache.http.impl.client.execchain.MainClientExec.execute(MainClientExec.java:305)
> ... 33 more
> I haven't narrowed down a minimal test case, but I can tell you that this
> change fixes it:
> Index:
> httpclient/httpclient/src/main/java/org/apache/http/impl/client/DefaultUserTokenHandler.java
> ===================================================================
> ---
> httpclient/httpclient/src/main/java/org/apache/http/impl/client/DefaultUserTokenHandler.java
> (revision 1427210)
> +++
> httpclient/httpclient/src/main/java/org/apache/http/impl/client/DefaultUserTokenHandler.java
> (working copy)
> @@ -76,7 +76,7 @@
>
> if (userPrincipal == null) {
> HttpConnection conn = clientContext.getConnection();
> - if (conn instanceof SocketClientConnection) {
> + if (conn instanceof SocketClientConnection && conn.isOpen()) {
> SSLSession sslsession = ((SocketClientConnection)
> conn).getSSLSession();
> if (sslsession != null) {
> userPrincipal = sslsession.getLocalPrincipal();
--
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: [email protected]
For additional commands, e-mail: [email protected]