JDK-6706251 : api/java_net/NetworkInterface/index.html#misc: getDisplayName() returned non null but empty String
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 6u10
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2008
  • CPU: x86
  • Submitted: 2008-05-22
  • Updated: 2017-05-16
  • Resolved: 2008-11-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7
6u11 b03Fixed 7Fixed
Description
JCK            : JCK-runtime-6a b14
J2SE           : FAIL - jdk6u10 build 23, 24
Platform[s]    : FAIL - Windows (2008) x86
switch/Mode    : FAIL - any

Test api/java_net/NetworkInterface/index.html#misc NetworkInterface2006 fails on stt-54.russia
with folowing  output:
"getDisplayName() returned non null but empty String."

Test passes on stt-53.russia.


You can use this code for reproduce:

import java.io.*;
import java.net.*;
import java.util.*;

public class abtest1 {

    public static void main(String argv[]) {
        Enumeration nis = null;

        try {
            nis = NetworkInterface.getNetworkInterfaces();
        } catch (SocketException se) {
            System.out.println("Unexpected " + se);
            se.printStackTrace();
            System.out.println("public String getDisplayName() Test Failed");
        }

        if(nis == null) {
            System.out.println("No network interfaces could be found on this machine");
            System.out.println("public String getDisplayName() Test Failed");
        }

        NetworkInterface ni = null;

        for(; nis.hasMoreElements(); ) {
            ni = (NetworkInterface)nis.nextElement();
            String name = ni.getDisplayName();
            System.out.println("getDisplayName():        " +  name );

            System.out.println("Name:                    " +  ni.getName());
            Enumeration<InetAddress> inetAddresses=ni.getInetAddresses();
            for (InetAddress inetAddress : Collections.list(inetAddresses))
            {
                System.out.println("InetAddress:               " + inetAddress);
            }

            if( name != null && name.equals("") )
            {
                System.out.println("getDisplayName() returned non null but empty String");
                System.out.println("public String getDisplayName() Test Failed");
            }

            System.out.println("");
        }

        System.out.println("OKAY");
    }
}

Comments
EVALUATION Fixed
03-11-2008