Hi Regis, I reproduced this failure on my Linux platform. Since the specs says SO_REUSEADDR "is used only for MulticastSockets in java, and it is set by default for MulticastSockets." So as you said, the default value for SO_REUSEADDR in ServerSocket which is not defined is reasonable. IMO, it is a non-bug difference between Harmony and RI.
2009/1/23 Regis <[email protected]> > did anyone notice the failures on linux? or it just happen on my local env? > junit.framework.AssertionFailedError: Unexpected exception when > setReuseAddress is the default case and we > bind:Harmony-L3NEK37/127.0.0.1:55891:java.net.BindException: The address > is not available > at junit.framework.Assert.fail(Assert.java:47) > at > org.apache.harmony.luni.tests.java.net.ServerSocketTest.test_setReuseAddressZ(ServerSocketTest.java:760) > at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java) > at java.lang.reflect.Method.invoke(Method.java:317) > at junit.framework.TestCase.runTest(TestCase.java:154) > at junit.framework.TestCase.runBare(TestCase.java:127) > at junit.framework.TestResult$1.protect(TestResult.java:106) > at junit.framework.TestResult.runProtected(TestResult.java:124) > at junit.framework.TestResult.run(TestResult.java:109) > at junit.framework.TestCase.run(TestCase.java:118) > at junit.framework.TestSuite.runTest(TestSuite.java:208) > at junit.framework.TestSuite.run(TestSuite.java:203) > at > org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128) > at > org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) > > I found the default value of ServerSocket.getReuseAddress() on Linux should > be true, but on Harmony is false, following simple test show this: > > ServerSocket serverSocket = new ServerSocket(); > System.out.println(serverSocket.getReuseAddress()); > > and I found it's introduced by commit r723103, and the code set default > value is removed intended, so I think there must be a reason. From spec, > it's undefined: > When a ServerSocket is created the initial setting of SO_REUSEADDR is not > defined > > So both Harmony and RI are reasonable. > > Should we follow RI or mark it as non-bug difference and correct the test > case? > > -- > Best Regards, > Regis. > -- Best Regards, Jim, Jun Jie Yu China Software Development Lab, IBM
