Remove class name from log messages.
[sonitus.git] / src / main / java / net / pterodactylus / sonitus / data / sink / Icecast2Sink.java
index cf098a9..0b55049 100644 (file)
@@ -123,9 +123,9 @@ public class Icecast2Sink implements Sink {
 
                this.source = source;
                try {
-                       logger.info(String.format("Icecast2Sink: Connecting to %s:%d...", server, port));
+                       logger.info(String.format("Connecting to %s:%d...", server, port));
                        final Socket socket = new Socket(server, port);
-                       logger.info("Icecast2Sink: Connected.");
+                       logger.info("Connected.");
                        final OutputStream socketOutputStream = socket.getOutputStream();
                        final InputStream socketInputStream = socket.getInputStream();
 
@@ -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. */
                        }
                }
        }