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

InterfaceAddress.getNetworkPrefixLength() does not conform to Javadoc

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 7
    • core-libs
    • x86
    • windows_7

      FULL PRODUCT VERSION :
      java version "1.7.0"
      Java(TM) SE Runtime Environment (build 1.7.0-b147)
      Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7600]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      IP: 192.168.0.103 Subnetmask: 255.255.255.000

      A DESCRIPTION OF THE PROBLEM :
      I'm trying to get a subnet prefix with InterfaceAddress.getNetworkPrefixLength() but it always returns 128 (except 127.0.0.1 this returns 8).

      It is exactly the same bug like this one: http://bugs.sun.com/view_bug.do?bug_id=6707289

      The above bug is marked is fixed but I don't think that it is fixed!



      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public static void main(String[] args) throws Exception {
              Enumeration<NetworkInterface> ifaces = NetworkInterface.getNetworkInterfaces();
              while (ifaces.hasMoreElements()) {
                  NetworkInterface iface = ifaces.nextElement();
                  for (InterfaceAddress ifaceAddress : iface.getInterfaceAddresses()) {
                      System.out.println("iface " + iface.getName() +
                                         " has address " + ifaceAddress.getAddress() +
                                         "/" + ifaceAddress.getNetworkPrefixLength());
                  }
              }
          }
      ---------- END SOURCE ----------

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: