< prev index next >

src/java.base/unix/native/libnet/SocketInputStream.c

Print this page
rev 14618 : 8158023: SocketExceptions contain too little information sometimes

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -109,12 +109,12 @@
                 if (errno == EBADF) {
                      JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
                 } else if (errno == ENOMEM) {
                     JNU_ThrowOutOfMemoryError(env, "NET_Timeout native heap allocation failed");
                 } else {
-                    NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
-                                                  "select/poll failed");
+                    JNU_ThrowByNameWithMessageAndLastError
+                        (env, JNU_JAVANETPKG "SocketException", "select/poll failed");
                 }
             }
             if (bufP != BUF) {
                 free(bufP);
             }

@@ -143,12 +143,12 @@
                      JNU_ThrowByName(env, JNU_JAVAIOPKG "InterruptedIOException",
                            "Operation interrupted");
                      break;
 
                 default:
-                    NET_ThrowByNameWithLastError(env,
-                        JNU_JAVANETPKG "SocketException", "Read failed");
+                    JNU_ThrowByNameWithMessageAndLastError
+                        (env, JNU_JAVANETPKG "SocketException", "Read failed");
             }
         }
     } else {
         (*env)->SetByteArrayRegion(env, data, off, nread, (jbyte *)bufP);
     }
< prev index next >