8198970: jnu_util.c compilation error on Solaris
authorrriggs
Fri, 02 Mar 2018 18:08:50 -0500
changeset 49123 d8057fc6fffc
parent 49122 fc16b5f193c7
child 49124 6abbc1f5c2a1
child 56284 8bf9a2a3ba82
8198970: jnu_util.c compilation error on Solaris Reviewed-by: mchung, redestad
src/java.base/share/native/libjava/jni_util.c
--- a/src/java.base/share/native/libjava/jni_util.c	Fri Mar 02 18:10:57 2018 -0400
+++ b/src/java.base/share/native/libjava/jni_util.c	Fri Mar 02 18:08:50 2018 -0500
@@ -803,10 +803,10 @@
             (strcmp(encname, "ISO-8859-1") == 0)) {
             fastEncoding = FAST_8859_1;
         } else if (strcmp(encname, "UTF-8") == 0) {
-            fastEncoding = FAST_UTF_8;
             jstring enc = (*env)->NewStringUTF(env, encname);
             if (enc == NULL)
                 return;
+            fastEncoding = FAST_UTF_8;
             jnuEncoding = (jstring)(*env)->NewGlobalRef(env, enc);
             (*env)->DeleteLocalRef(env, enc);
         } else if (strcmp(encname, "ISO646-US") == 0) {
@@ -818,10 +818,10 @@
             strcmp(encname, "utf-16le") == 0) {
             fastEncoding = FAST_CP1252;
         } else {
-            fastEncoding = NO_FAST_ENCODING;
             jstring enc = (*env)->NewStringUTF(env, encname);
             if (enc == NULL)
                 return;
+            fastEncoding = NO_FAST_ENCODING;
             jnuEncoding = (jstring)(*env)->NewGlobalRef(env, enc);
             (*env)->DeleteLocalRef(env, enc);
         }