From e44d9035a0f2e62d44d61be3c396a69d5049f58a Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 1 Sep 2010 19:53:49 +0200 Subject: [PATCH] Use Closer.close() for various resources. --- src/de/todesbaum/util/freenet/fcp2/Connection.java | 37 ++++++---------------- 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/src/de/todesbaum/util/freenet/fcp2/Connection.java b/src/de/todesbaum/util/freenet/fcp2/Connection.java index 82b4a6b..d8a8b2d 100644 --- a/src/de/todesbaum/util/freenet/fcp2/Connection.java +++ b/src/de/todesbaum/util/freenet/fcp2/Connection.java @@ -216,34 +216,15 @@ public class Connection { * Disconnects from the node. */ public void disconnect() { - if (nodeWriter != null) { - try { - nodeWriter.close(); - } catch (IOException ioe1) { - } - nodeWriter = null; - } - if (nodeOutputStream != null) { - try { - nodeOutputStream.close(); - } catch (IOException ioe1) { - } - nodeOutputStream = null; - } - if (nodeInputStream != null) { - try { - nodeInputStream.close(); - } catch (IOException ioe1) { - } - nodeInputStream = null; - } - if (nodeSocket != null) { - try { - nodeSocket.close(); - } catch (IOException ioe1) { - } - nodeSocket = null; - } + Closer.close(nodeWriter); + nodeWriter = null; + Closer.close(nodeOutputStream); + nodeOutputStream = null; + Closer.close(nodeInputStream); + nodeInputStream = null; + nodeInputStream = null; + Closer.close(nodeSocket); + nodeSocket = null; synchronized (this) { notify(); } -- 2.7.4