From 5b3515c2fe22320f0a0d8e2e2f10145c89a4cf92 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 17 Mar 2013 09:48:10 +0100 Subject: [PATCH] Fix compatibility with Java 1.6. --- .../java/net/pterodactylus/sonitus/data/sink/Icecast2Sink.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/pterodactylus/sonitus/data/sink/Icecast2Sink.java b/src/main/java/net/pterodactylus/sonitus/data/sink/Icecast2Sink.java index cf098a9..3bf942e 100644 --- a/src/main/java/net/pterodactylus/sonitus/data/sink/Icecast2Sink.java +++ b/src/main/java/net/pterodactylus/sonitus/data/sink/Icecast2Sink.java @@ -160,7 +160,9 @@ public class Icecast2Sink implements Sink { @Override protected void finish() throws IOException { Closeables.close(socketOutputStream, true); - Closeables.close(socket, true); + if (socket != null) { + socket.close(); + } } }).start(); @@ -200,9 +202,11 @@ public class Icecast2Sink implements Sink { } finally { try { Closeables.close(socketOutputStream, true); - Closeables.close(socket, true); + if (socket != null) { + socket.close(); + } } catch (IOException ioe1) { - /* ignore, will not happen. */ + /* ignore. */ } } } -- 2.7.4