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 35061a4332
commit c90de50ea7

View File

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