aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/utils
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2016-02-23 13:08:51 +0100
committersteckbrief <steckbrief@chefmail.de>2016-02-23 13:08:51 +0100
commitccd352fa86575264c21d8d77f9188e236fc5b965 (patch)
treec59e52c8d54fc3239004abefc4e55e44a0845f8f /src/main/java/de/thedevstack/conversationsplus/utils
parent64049eb335ef0fe2d0b39340f8e482962e7dc9ad (diff)
Resolved problem with closing sockets (java.lang.IncompatibleClassChangeError)
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/utils')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/utils/StreamUtil.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/StreamUtil.java b/src/main/java/de/thedevstack/conversationsplus/utils/StreamUtil.java
index 64f46314..729bdf11 100644
--- a/src/main/java/de/thedevstack/conversationsplus/utils/StreamUtil.java
+++ b/src/main/java/de/thedevstack/conversationsplus/utils/StreamUtil.java
@@ -6,6 +6,7 @@ import java.io.Closeable;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
+import java.net.Socket;
import de.thedevstack.conversationsplus.ConversationsPlusApplication;
@@ -40,6 +41,20 @@ public final class StreamUtil {
}
/**
+ * Closes a socket.
+ * IOException is silently ignored.
+ * @param socket the socket to close
+ */
+ public static void close(Socket socket) {
+ if (socket != null) {
+ try {
+ socket.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+
+ /**
* Avoid instantiation of util class.
*/
private StreamUtil() {