Fix compatibility with Java 1.6.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 17 Mar 2013 08:48:10 +0000 (09:48 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 17 Mar 2013 08:48:10 +0000 (09:48 +0100)
src/main/java/net/pterodactylus/sonitus/data/sink/Icecast2Sink.java

index cf098a9..3bf942e 100644 (file)
@@ -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. */
                        }
                }
        }