8035868: Check for JNI pending exceptions in windows/native/sun/net/spi/DefaultProxySelector.c

Reviewed-by: alanb
This commit is contained in:
Chris Hegarty 2014-03-02 19:21:18 +00:00
parent 22bc40c071
commit cde48c9e25

View File

@ -179,6 +179,11 @@ Java_sun_net_spi_DefaultProxySelector_getSystemProxy(JNIEnv *env,
*/ */
s = strtok(override, "; "); s = strtok(override, "; ");
urlhost = (*env)->GetStringUTFChars(env, host, &isCopy); urlhost = (*env)->GetStringUTFChars(env, host, &isCopy);
if (urlhost == NULL) {
if (!(*env)->ExceptionCheck(env))
JNU_ThrowOutOfMemoryError(env, NULL);
return NULL;
}
while (s != NULL) { while (s != NULL) {
if (strncmp(s, urlhost, strlen(s)) == 0) { if (strncmp(s, urlhost, strlen(s)) == 0) {
/** /**
@ -196,8 +201,11 @@ Java_sun_net_spi_DefaultProxySelector_getSystemProxy(JNIEnv *env,
} }
cproto = (*env)->GetStringUTFChars(env, proto, &isCopy); cproto = (*env)->GetStringUTFChars(env, proto, &isCopy);
if (cproto == NULL) if (cproto == NULL) {
goto noproxy; if (!(*env)->ExceptionCheck(env))
JNU_ThrowOutOfMemoryError(env, NULL);
return NULL;
}
/* /*
* Set default port value & proxy type from protocol. * Set default port value & proxy type from protocol.
@ -255,7 +263,9 @@ Java_sun_net_spi_DefaultProxySelector_getSystemProxy(JNIEnv *env,
if (pport == 0) if (pport == 0)
pport = defport; pport = defport;
jhost = (*env)->NewStringUTF(env, phost); jhost = (*env)->NewStringUTF(env, phost);
CHECK_NULL_RETURN(jhost, NULL);
isa = (*env)->CallStaticObjectMethod(env, isaddr_class, isaddr_createUnresolvedID, jhost, pport); isa = (*env)->CallStaticObjectMethod(env, isaddr_class, isaddr_createUnresolvedID, jhost, pport);
CHECK_NULL_RETURN(isa, NULL);
proxy = (*env)->NewObject(env, proxy_class, proxy_ctrID, type_proxy, isa); proxy = (*env)->NewObject(env, proxy_class, proxy_ctrID, type_proxy, isa);
return proxy; return proxy;
} }