JDK-6228205 : 5.0u3 b4 JCK test failing with -Xcheck:jni flag on Windows 2003
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 5.0u3
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2003
  • CPU: x86
  • Submitted: 2005-02-11
  • Updated: 2012-03-23
  • Resolved: 2005-03-23
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
5.0u3 b06Fixed 6Fixed
Related Reports
Relates :  
Description
I ran the JCK tests for 1.5.0_03 build4 with the -Xcheck:jni flag  on Windows 2003. 
One test failed that passes when you remove the -Xcheck:jni flag.

This test PASSES on Solaris sparc 10 and cinnebar.
The test FAILS on Windows 2003 AMD 64 and Windows 2003 x86 32 bit.

The failing test is:
api/java_net/MulticastSocket/descriptions.html#NetworkInterface

The error reported when the test fails:

test=api/java_net/MulticastSocket/descriptions.html#NetworkInterface
timeoutSeconds=600
work=C:\\JQA\\ts150\\jck\\workDir\\api\\java_net\\MulticastSocket

#section:script_messages
----------messages:(1/25)----------
Executing test class...

#section:testExecute
----------messages:(1/567)*----------
command: com.sun.jck.lib.ExecJCKTestOtherJVMCmd CLASSPATH=H:\\jck\\JCK-runtime-15\\classes LD_LIBRARY_PATH=H:\\jck\\JCK-runtime-15\\lib\\win64;C:\\WINDOWS\\system32\\jmx;C:\WINDOWS\\system32 SystemRoot=C:/WINDOWS TMP=C:\\JQA\\ts150\\jck\\workDir TEMP=C:\\JQA\\ts150\\jck\\workDir DISPLAY=pentane:0.0 c:\\progra~1\\java\\jdk1.5.0_03\\bin\\java.exe -Xcheck:jni -Djavatest.security.allowPropertiesAccess=true -Xfuture -Djava.security.policy=H:\\jck\\JCK-runtime-15\\lib\\jck.policy javasoft.sqe.tests.api.java.net.MulticastSocket.NetworkInterfaceTests -TestCaseID ALL
----------out1:(0/0)----------
----------out2:(14/1084)----------
FATAL ERROR in native method: JNI call made with exception pending
	at java.net.PlainDatagramSocketImpl.socketSetOption(Native Method)
	at java.net.PlainDatagramSocketImpl.setOption(PlainDatagramSocketImpl.java:299)
	at java.net.MulticastSocket.setNetworkInterface(MulticastSocket.java:502)
	- locked <0x000000005005ecd0> (a java.lang.Object)
	at javasoft.sqe.tests.api.java.net.MulticastSocket.NetworkInterfaceTests.MulticastSocket2015(NetworkInterfaceTests.java:71)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at javasoft.sqe.javatest.lib.MultiTest.invokeTestCase(MultiTest.java:399)
	at javasoft.sqe.javatest.lib.MultiTest.run(MultiTest.java:195)
	at javasoft.sqe.javatest.lib.MultiTest.run(MultiTest.java:127)
	at javasoft.sqe.tests.api.java.net.MulticastSocket.NetworkInterfaceTests.main(NetworkInterfaceTests.java:30)
result: Failed. unexpected exit code: exit code 1


Location of test file:
/net/latte.ireland/export/home4/jck/JCK-runtime-15/tests/api/java_net/MulticastSocket/NetworkInterfaceTests.java

Location of jtr file:
/net/latte.ireland/export/home6/sharon/JCKFailure/descriptions_NetworkInterface.jtr

To Reproduce:

Install jdk 1.5.0_03u4 on a Windows 2003 machine.
Map a network drive to /net/latte.ireland/export/home4/jck and set classpath
to /net/latte.ireland/export/home4/jck/JCK-runtime-15/lib/javatest.jar;/net/latte.ireland/export/home4/jck/JCK-runtime-15/classes
Copy the java test file from the above location and compile it.
Execute it with -Xcheck:jni - test fails
Execute it without the flag - test passes
set CLASSPATH=

###@###.### 2005-2-11 12:59:44 GMT

Comments
EVALUATION Problem happens when at least one network interface has no IP address currently assigned (eg. a wire-less adapter). In our native code, we throw an exception and then before the JNI call returns, we try to throw a second exception. This is not allowed. We should return immediately after the first exception is thrown. The problem is not specific to 2003 server. ###@###.### 2005-03-02 13:57:10 GMT
02-03-2005

SUGGESTED FIX In PlainDatagramSocketImpl.c (windows version) in function setMulticastInterface(), in both places where getInet4AddrFromIf() are called, add the following check in case where <0 returned. if ((*env)->ExceptionOccurred(env)) { return; } just before JNU_ThrowByName/NET_ThrowByName are called. ###@###.### 2005-03-02 13:57:10 GMT
02-03-2005