changeset 10721:43ef446016ad

8035868: Check for JNI pending exceptions in windows/native/sun/net/spi/DefaultProxySelector.c Reviewed-by: alanb
author chegar
date Tue, 03 Feb 2015 15:08:21 +0000
parents 257d1a42b058
children 92e445728c7d
files src/windows/native/sun/net/spi/DefaultProxySelector.c
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/windows/native/sun/net/spi/DefaultProxySelector.c	Tue Feb 03 15:03:23 2015 +0400
+++ b/src/windows/native/sun/net/spi/DefaultProxySelector.c	Tue Feb 03 15:08:21 2015 +0000
@@ -169,6 +169,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) {
               /**
@@ -186,8 +191,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.
@@ -245,7 +253,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;
         }