8035868: Check for JNI pending exceptions in windows/native/sun/net/spi/DefaultProxySelector.c
Reviewed-by: alanb
--- a/jdk/src/windows/native/sun/net/spi/DefaultProxySelector.c Sun Mar 02 15:56:07 2014 +0000
+++ b/jdk/src/windows/native/sun/net/spi/DefaultProxySelector.c Sun Mar 02 19:21:18 2014 +0000
@@ -179,6 +179,11 @@
*/
s = strtok(override, "; ");
urlhost = (*env)->GetStringUTFChars(env, host, &isCopy);
+ if (urlhost == NULL) {
+ if (!(*env)->ExceptionCheck(env))
+ JNU_ThrowOutOfMemoryError(env, NULL);
+ return NULL;
+ }
while (s != NULL) {
if (strncmp(s, urlhost, strlen(s)) == 0) {
/**
@@ -196,8 +201,11 @@
}
cproto = (*env)->GetStringUTFChars(env, proto, &isCopy);
- if (cproto == NULL)
- goto noproxy;
+ if (cproto == NULL) {
+ if (!(*env)->ExceptionCheck(env))
+ JNU_ThrowOutOfMemoryError(env, NULL);
+ return NULL;
+ }
/*
* Set default port value & proxy type from protocol.
@@ -255,7 +263,9 @@
if (pport == 0)
pport = defport;
jhost = (*env)->NewStringUTF(env, phost);
+ CHECK_NULL_RETURN(jhost, NULL);
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);
return proxy;
}