< prev index next >

src/windows/native/java/net/net_util_md.c

Print this page
rev 1552 : 8157749: Improve handling of DNS error replies
Reviewed-by: chegar, rriggs, coffeys


 204 {
 205     NET_ThrowNew(env, WSAGetLastError(), msg);
 206 }
 207 
 208 void
 209 NET_ThrowSocketException(JNIEnv *env, char* msg)
 210 {
 211     static jclass cls = NULL;
 212     if (cls == NULL) {
 213         cls = (*env)->FindClass(env, "java/net/SocketException");
 214         CHECK_NULL(cls);
 215         cls = (*env)->NewGlobalRef(env, cls);
 216         CHECK_NULL(cls);
 217     }
 218     (*env)->ThrowNew(env, cls, msg);
 219 }
 220 
 221 void
 222 NET_ThrowByNameWithLastError(JNIEnv *env, const char *name,
 223                    const char *defaultDetail) {
 224     char errmsg[255];
 225     sprintf(errmsg, "errno: %d, error: %s\n", WSAGetLastError(), defaultDetail);
 226     JNU_ThrowByNameWithLastError(env, name, errmsg);
 227 }
 228 
 229 jfieldID
 230 NET_GetFileDescriptorID(JNIEnv *env)
 231 {
 232     jclass cls = (*env)->FindClass(env, "java/io/FileDescriptor");
 233     CHECK_NULL_RETURN(cls, NULL);
 234     return (*env)->GetFieldID(env, cls, "fd", "I");
 235 }
 236 
 237 jint  IPv6_supported()
 238 {
 239     SOCKET s = socket(AF_INET6, SOCK_STREAM, 0) ;
 240     if (s == INVALID_SOCKET) {
 241         return JNI_FALSE;
 242     }
 243     closesocket(s);
 244 
 245     return JNI_TRUE;
 246 }




 204 {
 205     NET_ThrowNew(env, WSAGetLastError(), msg);
 206 }
 207 
 208 void
 209 NET_ThrowSocketException(JNIEnv *env, char* msg)
 210 {
 211     static jclass cls = NULL;
 212     if (cls == NULL) {
 213         cls = (*env)->FindClass(env, "java/net/SocketException");
 214         CHECK_NULL(cls);
 215         cls = (*env)->NewGlobalRef(env, cls);
 216         CHECK_NULL(cls);
 217     }
 218     (*env)->ThrowNew(env, cls, msg);
 219 }
 220 
 221 void
 222 NET_ThrowByNameWithLastError(JNIEnv *env, const char *name,
 223                    const char *defaultDetail) {
 224     JNU_ThrowByNameWithMessageAndLastError(env, name, defaultDetail);


 225 }
 226 
 227 jfieldID
 228 NET_GetFileDescriptorID(JNIEnv *env)
 229 {
 230     jclass cls = (*env)->FindClass(env, "java/io/FileDescriptor");
 231     CHECK_NULL_RETURN(cls, NULL);
 232     return (*env)->GetFieldID(env, cls, "fd", "I");
 233 }
 234 
 235 jint  IPv6_supported()
 236 {
 237     SOCKET s = socket(AF_INET6, SOCK_STREAM, 0) ;
 238     if (s == INVALID_SOCKET) {
 239         return JNI_FALSE;
 240     }
 241     closesocket(s);
 242 
 243     return JNI_TRUE;
 244 }


< prev index next >