Test run with: java version "1.6.0_10-ea" Java(TM) SE Runtime Environment (build 1.6.0_10-ea-b07) Java HotSpot(TM) Client VM (build 1.6.0_10-ea-b07, mixed mode) Steps to reproduce: 1. Install the kernel jre "*windows-i586-p-iftw-k.exe" 2. Make sure run the test from kerneljre's "initial form" (either immediately(before Kernel has time to finish background downloading)run test after install, or perform step 3 4) (optinal)3. Kill the background download ( by killing the "java" process ) (optinal)4. Remove all files under ${ProgramFiles}/Java/jre6/lib/bundles/ 5. Run following test : java Test Test should throw BindException, but it threw "java.net.SocketException: Unrecognized Windows Socket s error: 0: Cannot bin", see the output "output for the first run" 6. Run again: java Test Test pass this time ( with all needed components alread downloaded/installed after first time run ), and threw expected BindException, see the output "output for the second run" This test also "pass" with normal jdk/jre. But fail if run from "initial form" kernel jre. ---- Test.java ----- import java.net.*; import java.io.*; public class Test { public static void main(String args[]) throws Exception { DatagramSocket s1 = new DatagramSocket(null); s1.bind( new InetSocketAddress(5889) ); DatagramSocket s2 = new DatagramSocket(null); try { int port = s1.getLocalPort(); System.out.println("Try to bind again on " + port ); s2.bind( new InetSocketAddress(port) ); System.out.println("Test failed."); } catch (BindException e) { System.out.println("Test passed. Got expected BindException"); e.printStackTrace(); } s2.close(); s1.close(); } } ---- output for the first run ---- Try to bind again on 5889 Exception in thread "main" java.net.SocketException: Unrecognized Windows Sockets error: 0: Cannot bind at java.net.PlainDatagramSocketImpl.bind0(Native Method) at java.net.PlainDatagramSocketImpl.bind(PlainDatagramSocketImpl.java:82) at java.net.DatagramSocket.bind(DatagramSocket.java:368) at Test.main(Test.java:25) ---- output for the second run ---- Try to bind again on 5889 Test passed. Got expected BindException java.net.BindException: Address already in use: Cannot bind at java.net.PlainDatagramSocketImpl.bind0(Native Method) at java.net.PlainDatagramSocketImpl.bind(PlainDatagramSocketImpl.java:82) at java.net.DatagramSocket.bind(DatagramSocket.java:368) at Test.main(Test.java:25)
|