src/solaris/native/java/net/SocketInputStream.c

Print this page

        

@@ -98,13 +98,15 @@
     } else {
         bufP = BUF;
     }
 
     if (timeout) {
-        nread = NET_Timeout(fd, timeout);
+        nread = NET_Timeout(env, fd, timeout);
         if (nread <= 0) {
-            if (nread == 0) {
+            if ((*env)->ExceptionCheck(env)) {
+                // fall-through, to potentially free, then return
+            } else if (nread == 0) {
                 JNU_ThrowByName(env, JNU_JAVANETPKG "SocketTimeoutException",
                             "Read timed out");
             } else if (nread == -1) {
                 if (errno == EBADF) {
                      JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");