src/java.base/share/classes/java/net/SocketInputStream.java
changeset 49249 92cca24c8807
parent 48224 be0df5ab3093
child 52104 331fbd2db6b5
--- a/src/java.base/share/classes/java/net/SocketInputStream.java	Thu Mar 15 10:47:58 2018 +0000
+++ b/src/java.base/share/classes/java/net/SocketInputStream.java	Thu Mar 15 11:02:22 2018 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -40,8 +40,7 @@
  * @author      Jonathan Payne
  * @author      Arthur van Hoff
  */
-class SocketInputStream extends FileInputStream
-{
+class SocketInputStream extends FileInputStream {
     static {
         init();
     }
@@ -163,8 +162,6 @@
                     + " off == " + off + " buffer length == " + b.length);
         }
 
-        boolean gotReset = false;
-
         // acquire file descriptor and do the read
         FileDescriptor fd = impl.acquireFD();
         try {
@@ -173,39 +170,18 @@
                 return n;
             }
         } catch (ConnectionResetException rstExc) {
-            gotReset = true;
+            impl.setConnectionReset();
         } finally {
             impl.releaseFD();
         }
 
         /*
-         * We receive a "connection reset" but there may be bytes still
-         * buffered on the socket
-         */
-        if (gotReset) {
-            impl.setConnectionResetPending();
-            impl.acquireFD();
-            try {
-                n = socketRead(fd, b, off, length, timeout);
-                if (n > 0) {
-                    return n;
-                }
-            } catch (ConnectionResetException rstExc) {
-            } finally {
-                impl.releaseFD();
-            }
-        }
-
-        /*
          * If we get here we are at EOF, the socket has been closed,
          * or the connection has been reset.
          */
         if (impl.isClosedOrPending()) {
             throw new SocketException("Socket closed");
         }
-        if (impl.isConnectionResetPending()) {
-            impl.setConnectionReset();
-        }
         if (impl.isConnectionReset()) {
             throw new SocketException("Connection reset");
         }