Open GoogleCodeExporter opened 9 years ago
Same for me, quickfix:
### Eclipse Workspace Patch 1.0
#P junixsocket
Index: src/main/org/newsclub/net/unix/org_newsclub_net_unix_NativeUnixSocket.c
===================================================================
---
src/main/org/newsclub/net/unix/org_newsclub_net_unix_NativeUnixSocket.c (revisio
n 111)
+++
src/main/org/newsclub/net/unix/org_newsclub_net_unix_NativeUnixSocket.c (working
copy)
@@ -68,11 +68,20 @@
* @author Christian Kohlschuetter
*/
void org_newsclub_net_unix_NativeUnixSocket_throwException(JNIEnv* env, char* message, jstring file) {
- jclass exc = (*env)->FindClass(env,
"org/newsclub/net/unix/AFUNIXSocketException");
- jmethodID constr = (*env)->GetMethodID(env, exc, "<init>",
"(Ljava/lang/String;Ljava/lang/String;)V");
+ jclass exc;
+ jmethodID constr;
jstring str = (*env)->NewStringUTF(env, message);
- jthrowable t = (jthrowable)(*env)->NewObject(env, exc, constr, str, file);
- (*env)->Throw(env, t);
+ jthrowable t;
+ if (errno == EAGAIN || errno == EWOULDBLOCK) {
+ exc = (*env)->FindClass(env, "java/net/SocketTimeoutException");
+ constr = (*env)->GetMethodID(env, exc, "<init>", "(Ljava/lang/String;)V");
+ t = (jthrowable)(*env)->NewObject(env, exc, constr, str);
+ } else {
+ exc = (*env)->FindClass(env, "org/newsclub/net/unix/AFUNIXSocketException");
+ constr = (*env)->GetMethodID(env, exc, "<init>",
"(Ljava/lang/String;Ljava/lang/String;)V");
+ t = (jthrowable)(*env)->NewObject(env, exc, constr, str, file);
+ }
+ (*env)->Throw(env, t);
}
int org_newsclub_net_unix_NativeUnixSocket_getFD(JNIEnv * env, jobject fd) {
Original comment by paullus...@gmail.com
on 4 Jan 2012 at 9:47
Original issue reported on code.google.com by
droid.l...@gmail.com
on 1 Jan 2012 at 8:41