JDK-6209692 : Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArra! message in-Xcheck:jni
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.2_07,5.0u8
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows,windows_xp
  • CPU: generic,x86
  • Submitted: 2004-12-16
  • Updated: 2010-12-02
  • Resolved: 2005-04-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other JDK 6
1.4.2_09 b01Fixed 6Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
This bug is encountered while running DND jck test with -Xcheck:jni.
(See bug 6205044 for the original info below).
FULL PORDUCT VERSION :
java version "1.4.2_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_07-b04)
Java HotSpot(TM) Client VM (build 1.4.2_07-b04, mixed mode)

FULL OS
1. WindowsXPPro Version 5.1(Build 2600.xpsp_sp2_rtm.040803-2158: Service Pack 2)
  and
2. WindowsXPPRO Version 5.1(Build 2600.xpsp2.030422-1633: Service Pack 1)

DESCRIPTION
This warning occurs when executing JCK-Runtime tests using the flag Xcheck:jni
There is one failure javasoft.sqe.tests.api.java.awt.interactive.DnDComponentTest


"Warning: Calling other JNI functions in the scope of 
Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical"

To Reproduce Windows only
==================================================================
1. Map z: to \\latte.ireland\JCK
2. set CLASSPATH=Z:\jck\JCK-runtime-14a\classes
3. set PATH=z:/jck/JCK-runtime-14a/lib/windows
4. set SystemRoot=c:\Windows or c:winnt etc..
5. Install the jdk locally on your machine.
   or map j: to /net/latte.ireland/deployment4/jdk/1.4.2_07b04/windows-i586
6. put java in your PATH
7  java -Xcheck:jni -Djava.awt.headless=false -Xfuture -Djava.security.policy=Z:\jck\JCK-runtime-14a\lib\jck.policy javasoft.sqe.tests.api.java.awt.interactive.DnDComponentTest -platform.robotAvailable true -TestCaseID ALL
 



###@###.### 2004-12-16 20:06:32 GMT

Comments
SUGGESTED FIX *** /tmp/geta2149 28 17:50:25 2005 --- awt_Font.cpp 28 17:50:00 2005 *************** *** 708,713 **** --- 708,714 ---- * extend buflen and bad things will happen. */ unsigned char* buffer = NULL; + jboolean unicodeUsed = env->GetBooleanField(fontDescriptor,AwtFont::useUnicodeID); try { buffer = (unsigned char *) env->GetPrimitiveArrayCritical(convertedBytes, 0); *************** *** 722,728 **** */ char* offsetBuffer = (char *)(buffer + 4); ! if (env->GetBooleanField(fontDescriptor,AwtFont::useUnicodeID)) { VERIFY(!draw || ::TextOutW(hDC, x, y, (LPCWSTR)offsetBuffer, buflen / 2)); VERIFY(::GetTextExtentPoint32W(hDC, (LPCWSTR)offsetBuffer, buflen / 2, &temp)); } --- 723,729 ---- */ char* offsetBuffer = (char *)(buffer + 4); ! if (unicodeUsed) { VERIFY(!draw || ::TextOutW(hDC, x, y, (LPCWSTR)offsetBuffer, buflen / 2)); VERIFY(::GetTextExtentPoint32W(hDC, (LPCWSTR)offsetBuffer, buflen / 2, &temp)); } ###@###.### 2005-1-28 14:53:52 GMT
2005-01-28

EVALUATION 1.4.2_07: (Haven't looked at 1.5+) JNI Warning messages path: checked_jni_GetBooleanField(JNIEnv_ * 0x007445c4, _jobject * 0x0076b220, _jfieldID * 0xebc9f863) line 991 + 172 bytes JNIEnv_::GetBooleanField(_jobject * 0x0076b220, _jfieldID * 0xebc9f863) line 1255 src/windows/native/sun/windows/awt_Font.cpp: 800 unsigned char* buffer = NULL; 801 try { 802 buffer = (unsigned char *) 803 env->GetPrimitiveArrayCritical(convertedBytes, 0); ________________________________________________ 804 int buflen = (buffer[0] << 24) | (buffer[1] << 16) | 805 (buffer[2] << 8) | buffer[3]; 806 807 DASSERT(buflen >= 0); 808 809 /* 810 * the offsetBuffer, on the other hand, must be signed because 811 * TextOutA and GetTextExtentPoint32A expect it. 812 */ 813 char* offsetBuffer = (char *)(buffer + 4); 814 815 if (env->GetBooleanField(fontDescriptor,AwtFont::useUnicodeID)) { ==================== Causes : "Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical" message in -Xcheck:jni 816 VERIFY(!draw || ::TextOutW(hDC, x, y, (LPCWSTR)offsetBuffer, buflen / 2)); 817 VERIFY(::GetTextExtentPoint32W(hDC, (LPCWSTR)offsetBuffer, buflen / 2, &temp)); 818 } 819 else { 820 VERIFY(!draw || ::TextOutA(hDC, x, y, offsetBuffer, buflen)); 821 VERIFY(::GetTextExtentPoint32A(hDC, offsetBuffer, buflen, &temp)); 822 } 823 } catch (...) { 824 if (buffer != NULL) { 825 env->ReleasePrimitiveArrayCritical(convertedBytes, buffer, 826 0); 827 } 828 throw; 829 } 830 env->ReleasePrimitiveArrayCritical(convertedBytes, buffer, 0); AwtFont::DrawStringSize_sub(_jstring * 0x0006f408, HDC__ * 0x8c010447, _jobject * 0x0076b20c, long 0, long 0, int 0, unsigned int 0) line 815 + 18 bytes AwtFont::getMFStringSize(HDC__ * 0x8c010447, _jobject * 0x0076b20c, _jstring * 0x0006f408, unsigned int 0) line 204 + 27 bytes AwtFont::getMFStringWidth(HDC__ * 0x8c010447, _jobject * 0x0076b20c, _jstring * 0x0006f408) line 210 + 19 bytes Java_sun_awt_windows_WFontMetrics_stringWidth(JNIEnv_ * 0x007445c4, _jobject * 0x0006f40c, _jstring * 0x0006f408) line 881 + 17 bytes AwtToolkit::MessageLoop(void (void)* 0x187d86df AwtToolkit::PrimaryIdleFunc(void), int (tagMSG &)* 0x187d8709 AwtToolkit::CommonPeekMessageFunc(tagMSG &)) line 956 Java_sun_awt_windows_WToolkit_eventLoop(JNIEnv_ * 0x00795304, _jobject * 0x18d9fc40) line 1653 ###@###.### 2004-12-16 20:06:32 GMT Reproducible with last Tiger builds excluding updates. Already fixed during 5076963 (fixed in Tiger update 3 and Mustang) and will be closed as duplicate. ###@###.### 2004-12-17 10:50:12 GMT Possibly another bug not related with pointed above. Assign to 2D for make decision since awt_Font.cpp causes warning. ###@###.### 2004-12-20 13:15:54 GMT It would be sufficient to move condition definition outside of GetPrimitiveArrayCritical/ReleasePrimitiveArrayCritical. ###@###.### 2005-1-28 14:53:52 GMT
2004-12-16