src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java
branchhttp-client-branch
changeset 56344 2f3c34e2b691
parent 56262 d818a6a8295a
parent 49271 7b35d2a59fb3
child 56451 9585061fdb04
--- a/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java	Thu Mar 22 16:09:01 2018 +0000
+++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java	Thu Mar 22 16:13:36 2018 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -395,7 +395,6 @@
                         } else {
                             try {
                                 if (key.isReadable()) {
-                                    boolean closed;
                                     SocketChannel chan = (SocketChannel)key.channel();
                                     HttpConnection conn = (HttpConnection)key.attachment();
 
@@ -408,7 +407,7 @@
                                     }
                                     handle (chan, conn);
                                 } else {
-                                    assert false;
+                                    assert false : "Unexpected non-readable key:" + key;
                                 }
                             } catch (CancelledKeyException e) {
                                 handleException(key, null);
@@ -437,7 +436,6 @@
         }
 
         public void handle (SocketChannel chan, HttpConnection conn)
-        throws IOException
         {
             try {
                 Exchange t = new Exchange (chan, protocol, conn);
@@ -448,6 +446,9 @@
             } catch (IOException e) {
                 logger.log (Level.TRACE, "Dispatcher (5)", e);
                 closeConnection(conn);
+            } catch (Throwable e) {
+                logger.log (Level.TRACE, "Dispatcher (6)", e);
+                closeConnection(conn);
             }
         }
     }