You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Tony Wu (JIRA)" <ji...@apache.org> on 2006/12/22 16:10:23 UTC

[jira] Commented: (HARMONY-2410) [classlib][luni] java.net.MulticastSocket.setInterface(InetAddress) doesn't throw SocketException

    [ http://issues.apache.org/jira/browse/HARMONY-2410?page=comments#action_12460511 ] 
            
Tony Wu commented on HARMONY-2410:
----------------------------------

Hi Artem,

I tried your testcase but can not reproduce this bug. Harmony does throw the SocketException:

java.net.SocketException: The address is not available
	at org.apache.harmony.luni.platform.OSNetworkSystem.setSocketOptionImpl(Native Method)

I have tried to revert the MulticastSocket class to 3 previous reversion, and they all passed. would you please help to verify it? Thanks a lot.

> [classlib][luni] java.net.MulticastSocket.setInterface(InetAddress) doesn't throw SocketException
> -------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2410
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2410
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Artem Aliev
>
> Problem details: Harmony does not throw SocketException for
> java.net.MulticastSocket.setInterface(InetAddress)  while RI does.
> java 1.5 spec says:
> Throws: 
> SocketException - if there is an error in the underlying protocol, such as a
> TCP error.
> test for reproducing:
> import junit.framework.TestCase; 
> import java.net.*; 
> import java.io.IOException; 
> public class test extends TestCase { 
>         public void testcase0() { 
>         InetAddress ia = null; 
>         try{ 
>          ia = InetAddress.getByName("224.0.0.5"); 
>         } 
>         catch(UnknownHostException e) {e.printStackTrace();} 
>         MulticastSocket mcs = null; 
>         try{ 
>             mcs = new MulticastSocket(); 
>         } 
>         catch (IOException ioe) {ioe.printStackTrace();} 
>         try{ 
>                 mcs.setInterface(ia); 
>                 assertEquals(true,false); 
>         } 
>         catch(SocketException se){se.printStackTrace();} 
>                 assertEquals(true,true); 
>         } 
> } 
> OUTPUT:
> HARMONY_j9:/export/users/varistov/UTG/drl/drl_20060929_lnx_ia32_0002_gcc_r_complete_GIT_M
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software
> Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = rsvn: '.' is not a working copy, (Sep 29 2006), Linux/ia32/gcc 3.3.3,
> release build
> http://incubator.apache.org/harmony
> .F
> Time: 0.028
> There was 1 failure:
> 1) testcase0(test)junit.framework.AssertionFailedError: expected:<true> but
> was:<false>
>         at test.testcase0(test.java:17)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0
> ------------------------------------------------------------------------
> SUN
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> .java.net.SocketException: bad argument for IP_MULTICAST_IF: address not bound
> to any interface
>         at java.net.PlainDatagramSocketImpl.socketSetOption(Native Method)
>         at
> java.net.PlainDatagramSocketImpl.setOption(PlainDatagramSocketImpl.java:299)
>         at java.net.MulticastSocket.setInterface(MulticastSocket.java:420)
>         at test.testcase0(test.java:17)
>         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 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 junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Time: 0.023
> OK (1 test)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira