diff options
author | Paul Hawke <paul.hawke@gmail.com> | 2014-01-28 22:36:21 -0600 |
---|---|---|
committer | Paul Hawke <paul.hawke@gmail.com> | 2014-01-28 22:36:21 -0600 |
commit | c7fd739559d0f33a7fdbc831183acc5e2b0b15bb (patch) | |
tree | 07de62137b63bdf4ec6c31a70b77746a0c27e1fb | |
parent | 82a5f5ce72b7434b2138987ac13aff87598b8e06 (diff) | |
download | nanohttpd-c7fd739559d0f33a7fdbc831183acc5e2b0b15bb.tar.gz |
At JDK 1.6 Socket+ServerSocket need a distinct close method - not implementors of Closeable
-rw-r--r-- | core/src/main/java/fi/iki/elonen/NanoHTTPD.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/core/src/main/java/fi/iki/elonen/NanoHTTPD.java b/core/src/main/java/fi/iki/elonen/NanoHTTPD.java index 503eeb8..014a2e9 100644 --- a/core/src/main/java/fi/iki/elonen/NanoHTTPD.java +++ b/core/src/main/java/fi/iki/elonen/NanoHTTPD.java @@ -140,6 +140,24 @@ public abstract class NanoHTTPD { } } + private static final void safeClose(Socket closeable) { + if (closeable != null) { + try { + closeable.close(); + } catch (IOException e) { + } + } + } + + private static final void safeClose(ServerSocket closeable) { + if (closeable != null) { + try { + closeable.close(); + } catch (IOException e) { + } + } + } + /** * Start the server. * |