jdk/test/com/sun/net/httpserver/FileServerHandler.java
changeset 45531 fb3dbffad37b
parent 36131 379db4b2f95d
child 45535 4b19310ae4ee
--- a/jdk/test/com/sun/net/httpserver/FileServerHandler.java	Thu Jun 08 12:24:13 2017 +0100
+++ b/jdk/test/com/sun/net/httpserver/FileServerHandler.java	Thu Jun 08 12:41:07 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -214,8 +214,8 @@
             t.sendResponseHeaders(200, in.length);
             OutputStream os = t.getResponseBody();
             os.write(in);
-            os.close();
-            is.close();
+            close(os);
+            close(is);
         } else {
             OutputStream os = t.getResponseBody();
             byte[] buf = new byte[64 * 1024];
@@ -232,9 +232,15 @@
                 String s = Integer.toString(count);
                 os.write(s.getBytes());
             }
+            close(os);
+            close(is);
+        }
+    }
+
+    protected void close(OutputStream os) throws IOException {
             os.close();
+    }
+    protected void close(InputStream is) throws IOException {
             is.close();
         }
     }
-}
-