From: David ‘Bombe’ Roden Date: Sun, 17 Mar 2013 08:48:10 +0000 (+0100) Subject: Fix compatibility with Java 1.6. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=5b3515c2fe22320f0a0d8e2e2f10145c89a4cf92;p=sonitus.git Fix compatibility with Java 1.6. --- 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. */ } } }