From: David ‘Bombe’ Roden Date: Wed, 1 Sep 2010 17:53:49 +0000 (+0200) Subject: Use Closer.close() for various resources. X-Git-Tag: 0.10-rc1~79 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=e44d9035a0f2e62d44d61be3c396a69d5049f58a;p=jSite.git Use Closer.close() for various resources. --- 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(); }