8172813: test/java/awt/font/JNICheck/JNICheck.sh fails on Linux
authorprr
Thu, 19 Jan 2017 12:04:58 -0800
changeset 43311 453e9d97f99a
parent 43310 0746906c86f6
child 43312 ea80ab476988
8172813: test/java/awt/font/JNICheck/JNICheck.sh fails on Linux Reviewed-by: serb, psadhukhan, pnarayanan
jdk/src/java.desktop/unix/native/common/awt/fontpath.c
jdk/test/java/awt/font/JNICheck/JNICheck.sh
--- a/jdk/src/java.desktop/unix/native/common/awt/fontpath.c	Wed Jan 18 17:36:24 2017 -0800
+++ b/jdk/src/java.desktop/unix/native/common/awt/fontpath.c	Thu Jan 19 12:04:58 2017 -0800
@@ -1137,6 +1137,7 @@
                 JNU_CHECK_EXCEPTION(env);
 
                 (*env)->SetObjectArrayElement(env, cacheDirArray, cnt++, jstr);
+                (*env)->DeleteLocalRef(env, jstr);
             }
             (*FcStrListDone)(cacheDirs);
         }
@@ -1163,10 +1164,13 @@
             (jstring)((*env)->GetObjectField(env, fcCompFontObj, fcNameID));
         fcName = (*env)->GetStringUTFChars(env, fcNameStr, 0);
         if (fcName == NULL) {
+            (*env)->DeleteLocalRef(env, fcCompFontObj);
+            (*env)->DeleteLocalRef(env, fcNameStr);
             continue;
         }
         pattern = (*FcNameParse)((FcChar8 *)fcName);
         (*env)->ReleaseStringUTFChars(env, fcNameStr, (const char*)fcName);
+        (*env)->DeleteLocalRef(env, fcNameStr);
         if (pattern == NULL) {
             closeFontConfig(libfontconfig, JNI_FALSE);
             return;
@@ -1326,20 +1330,24 @@
                 jstr = (*env)->NewStringUTF(env, (const char*)family[j]);
                 if (IS_NULL(jstr)) break;
                 (*env)->SetObjectField(env, fcFont, familyNameID, jstr);
+                (*env)->DeleteLocalRef(env, jstr);
                 if (file[j] != NULL) {
                     jstr = (*env)->NewStringUTF(env, (const char*)file[j]);
                     if (IS_NULL(jstr)) break;
                     (*env)->SetObjectField(env, fcFont, fontFileID, jstr);
+                    (*env)->DeleteLocalRef(env, jstr);
                 }
                 if (styleStr[j] != NULL) {
                     jstr = (*env)->NewStringUTF(env, (const char*)styleStr[j]);
                     if (IS_NULL(jstr)) break;
                     (*env)->SetObjectField(env, fcFont, styleNameID, jstr);
+                    (*env)->DeleteLocalRef(env, jstr);
                 }
                 if (fullname[j] != NULL) {
                     jstr = (*env)->NewStringUTF(env, (const char*)fullname[j]);
                     if (IS_NULL(jstr)) break;
                     (*env)->SetObjectField(env, fcFont, fullNameID, jstr);
+                    (*env)->DeleteLocalRef(env, jstr);
                 }
                 if (fn==0) {
                     (*env)->SetObjectField(env, fcCompFontObj,
@@ -1348,10 +1356,16 @@
                 if (includeFallbacks) {
                     (*env)->SetObjectArrayElement(env, fcFontArr, fn++,fcFont);
                 } else {
+                    (*env)->DeleteLocalRef(env, fcFont);
                     break;
                 }
+                (*env)->DeleteLocalRef(env, fcFont);
             }
         }
+        if (includeFallbacks) {
+            (*env)->DeleteLocalRef(env, fcFontArr);
+        }
+        (*env)->DeleteLocalRef(env, fcCompFontObj);
         (*FcFontSetDestroy)(fontset);
         (*FcPatternDestroy)(pattern);
         free(family);
--- a/jdk/test/java/awt/font/JNICheck/JNICheck.sh	Wed Jan 18 17:36:24 2017 -0800
+++ b/jdk/test/java/awt/font/JNICheck/JNICheck.sh	Thu Jan 19 12:04:58 2017 -0800
@@ -23,7 +23,7 @@
 #
 #
 #   @test
-#   @bug        6430247 8130507 8020448
+#   @bug        6430247 8130507 8020448 8172813
 #   @summary    Tests that there are no JNI warnings.
 #   @compile JNICheck.java
 #   @run shell/timeout=300 JNICheck.sh
@@ -49,7 +49,7 @@
 fi
 
 $JAVA_HOME/bin/java ${TESTVMOPTS} \
-    -cp "${CP}" -Xcheck:jni JNICheck > "${CP}"/log.txt
+    -cp "${CP}" -Xcheck:jni JNICheck | grep -v SIG | grep -v Signal | grep -v CallStatic > "${CP}"/log.txt
 
 # any messages logged may indicate a failure.
 if [ -s "${CP}"/log.txt ]; then