Use correct exception message when throw exception from native code

Motivation:

We sometimes not use the correct exception message when throw it from the native code.

Modifications:

Fixed the message.

Result:

Correct message in exception
This commit is contained in:
Norman Maurer 2014-07-28 13:31:26 -07:00
parent 750eed1804
commit 3207fac88e

View File

@ -424,7 +424,7 @@ JNIEXPORT jint JNICALL Java_io_netty_channel_epoll_Native_eventFd(JNIEnv * env,
if (eventFD < 0) { if (eventFD < 0) {
int err = errno; int err = errno;
throwRuntimeException(env, exceptionMessage("Error creating eventFD(...): ", err)); throwRuntimeException(env, exceptionMessage("Error calling eventfd(...): ", err));
} }
return eventFD; return eventFD;
} }
@ -457,8 +457,13 @@ JNIEXPORT jint JNICALL Java_io_netty_channel_epoll_Native_epollCreate(JNIEnv * e
} }
if (efd < 0) { if (efd < 0) {
int err = errno; int err = errno;
if (epoll_create1) {
throwRuntimeException(env, exceptionMessage("Error during epoll_create1(...): ", err));
} else {
throwRuntimeException(env, exceptionMessage("Error during epoll_create(...): ", err)); throwRuntimeException(env, exceptionMessage("Error during epoll_create(...): ", err));
} }
return efd;
}
if (!epoll_create1) { if (!epoll_create1) {
if (fcntl(efd, F_SETFD, FD_CLOEXEC) < 0) { if (fcntl(efd, F_SETFD, FD_CLOEXEC) < 0) {
int err = errno; int err = errno;
@ -954,7 +959,7 @@ JNIEXPORT jlong JNICALL Java_io_netty_channel_epoll_Native_sendfile(JNIEnv *env,
if (err == EAGAIN) { if (err == EAGAIN) {
return 0; return 0;
} }
throwIOException(env, exceptionMessage("Error during accept(...): ", err)); throwIOException(env, exceptionMessage("Error during sendfile(...): ", err));
return -1; return -1;
} }
if (res > 0) { if (res > 0) {