From 30eb471da77321cd18be021f020144e68a5e3d45 Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Wed, 25 Aug 2010 19:57:51 +0000 Subject: [PATCH] Catch and log I/O exceptions thrown by #close() and #shutdown() methods git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@989328 13f79535-47bb-0310-9956-ffa450edef68 --- .../impl/conn/DefaultClientConnection.java | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/httpclient/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java b/httpclient/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java index 107a97537..a45133bba 100644 --- a/httpclient/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java +++ b/httpclient/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java @@ -146,20 +146,26 @@ public class DefaultClientConnection extends SocketHttpClientConnection */ @Override public void shutdown() throws IOException { - log.debug("Connection shut down"); shutdown = true; - - super.shutdown(); - Socket sock = this.socket; // copy volatile attribute - if (sock != null) - sock.close(); - + try { + super.shutdown(); + log.debug("Connection shut down"); + Socket sock = this.socket; // copy volatile attribute + if (sock != null) + sock.close(); + } catch (IOException ex) { + log.debug("I/O error shutting down connection", ex); + } } @Override public void close() throws IOException { - log.debug("Connection closed"); - super.close(); + try { + super.close(); + log.debug("Connection closed"); + } catch (IOException ex) { + log.debug("I/O error closing connection", ex); + } } @Override