Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6386190

NetworkInterface.is(Up/isPointToPoint/supportsMulticast/isLoopback) not working in Solaris Zones

XMLWordPrintable

    • b81
    • generic
    • solaris_10
    • Verified

      Test fail in solaris nonglobal zone but pass in global zone.
      api/java_net/MulticastSocket/descriptions.html#NetworkInterface[MulticastSocket2015]

      JCK : JCK-runtime60 b16
      J2SE : FAIL - found in b68
      Platform[s] : FAIL - solaris 10 sparc nonglobal zone
                       PASS - solaris 10 sparc global zone

      JCK test owner : http://javaweb.sfbay/jcce/tcks/jck/docs/others/owners.jto

      Failing Tests:
      ===============
      api/java_net/MulticastSocket/descriptions.html#NetworkInterface[MulticastSocket2015]

      jtr file location:
      ==================
      attached

      How to reproduce:
      ====================
      /*
       * Main.java
       *
       * Created on February 15, 2006, 7:23 PM
       *
       * To change this template, choose Tools | Template Manager
       * and open the template in the editor.
       */

      package networkingtest;

      import java.io.IOException;
      import java.net.MulticastSocket;
      import java.net.NetworkInterface;
      import java.net.SocketException;
      import java.util.Enumeration;
      import javax.net.ssl.SSLEngineResult.Status;

      /**
       *
       * @author dt160296
       */
      public class Main {
          
          /** Creates a new instance of Main */
          public Main() {
          }
          
          /**
           * @param args the command line arguments
           */
          public static void main(String[] args) {
           String testCaseID = "MulticastSocket2015";
              System.out.println(" >> " + testCaseID + ": " + "public void setNetworkInterface(NetworkInterface netIf) throws SocketException");

              try {
                  MulticastSocket ms = new MulticastSocket();
                  try {
                      try {
                          Enumeration e = NetworkInterface.getNetworkInterfaces();
                          // If there are network interfaces
                          if(e == null) {
                              System.out.println("OKAY: No network interfaces");
                              return;
                          }

                          while (e.hasMoreElements()) {
                              NetworkInterface ni = (NetworkInterface)e.nextElement();
                              if( ni.supportsMulticast() ){
                                  try {
                                      ms.setNetworkInterface(ni);
                                      if( !ni.equals(ms.getNetworkInterface()) ) {
                                          System.out.println("getNetworkInterface() does not return the multicast network interface set with setNetworkInterface()");
                                          System.out.println("public void setNetworkInterface(NetworkInterface netIf) throws SocketException Test Failed");
                                          return;
                                      }
                                  } catch (SocketException se) {
                                      // SocketException may be correctly thrown if No IP addresses bound to interface
                                      Enumeration boundAddresses = ni.getInetAddresses();
                                      if (boundAddresses != null && boundAddresses.hasMoreElements()) {
                                          System.out.println("Unexpected " + se);
                                          System.out.println("ni: " + ni);
                                          se.printStackTrace();
                                          System.out.println("public void setNetworkInterface(NetworkInterface netIf) throws SocketException Test Failed");
                                          return;
                                      }
                                  }
                              }
                          }
                      } catch (SocketException se) {
                          System.out.println("Unexpected " + se);
                          se.printStackTrace();
                          System.out.println("public void setNetworkInterface(NetworkInterface netIf) throws SocketException Test Failed");
                          return;
                      }
                  } finally {
                      ms.close();
                  }
              } catch(IOException ioe) {
                  System.out.println("Unexpected " + ioe);
                  ioe.printStackTrace();
                  System.out.println("public void setNetworkInterface(NetworkInterface netIf) throws SocketException Test Failed");
                  return;
              }
              System.out.println("OKAY!");
          }
          
      }

      Test output:
      =============
      java.net.SocketException: No such device or address
              at java.net.NetworkInterface.supportsMulticast0(Native Method)
              at java.net.NetworkInterface.supportsMulticast(NetworkInterface.java:361)
              at networkingtest.Main.main(Main.java:49)


      Specific Machine Info:
      =====================
      checked on couple different solaris with configured zones

            chegar Chris Hegarty
            dtoporovsunw Denis Toporov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: