< prev index next >
src/java.base/unix/native/libnet/SocketOutputStream.c
Print this page
rev 14618 : 8158023: SocketExceptions contain too little information sometimes
*** 1,7 ****
/*
! * Copyright (c) 1997, 2008, 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
--- 1,7 ----
/*
! * 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
*** 67,85 ****
char BUF[MAX_BUFFER_LEN];
int buflen;
int fd;
if (IS_NULL(fdObj)) {
! JNU_ThrowByName(env, "java/net/SocketException", "Socket closed");
return;
} else {
fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
/* Bug 4086704 - If the Socket associated with this file descriptor
* was closed (sysCloseFD), the file descriptor is set to -1.
*/
if (fd == -1) {
! JNU_ThrowByName(env, "java/net/SocketException", "Socket closed");
return;
}
}
--- 67,85 ----
char BUF[MAX_BUFFER_LEN];
int buflen;
int fd;
if (IS_NULL(fdObj)) {
! JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
return;
} else {
fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
/* Bug 4086704 - If the Socket associated with this file descriptor
* was closed (sysCloseFD), the file descriptor is set to -1.
*/
if (fd == -1) {
! JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
return;
}
}
*** 112,123 ****
}
if (errno == ECONNRESET) {
JNU_ThrowByName(env, "sun/net/ConnectionResetException",
"Connection reset");
} else {
! NET_ThrowByNameWithLastError(env, "java/net/SocketException",
! "Write failed");
}
if (bufP != BUF) {
free(bufP);
}
return;
--- 112,123 ----
}
if (errno == ECONNRESET) {
JNU_ThrowByName(env, "sun/net/ConnectionResetException",
"Connection reset");
} else {
! JNU_ThrowByNameWithMessageAndLastError
! (env, JNU_JAVANETPKG "SocketException", "Write failed");
}
if (bufP != BUF) {
free(bufP);
}
return;
< prev index next >