8035868: Check for JNI pending exceptions in windows/native/sun/net/spi/DefaultProxySelector.c
authorchegar
Sun, 02 Mar 2014 19:21:18 +0000
changeset 23042 cf5449a4da71
parent 23041 1aa7ce9cd0f1
child 23043 15face72cb3b
8035868: Check for JNI pending exceptions in windows/native/sun/net/spi/DefaultProxySelector.c Reviewed-by: alanb
jdk/src/windows/native/sun/net/spi/DefaultProxySelector.c
--- 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;
         }