JDK-7112820 : NullPointerException in java.net.NetworkInterface.getInterfaceAddresses()
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2003
  • CPU: x86
  • Submitted: 2011-11-17
  • Updated: 2017-09-11
  • Resolved: 2013-08-23
Related Reports
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :
This is from a user bug report:

        java.runtime.name=Java(TM) SE Runtime Environment
        java.runtime.version=1.7.0_02-ea-b11
        java.specification.name=Java Platform API Specification
        java.specification.vendor=Oracle Corporation
        java.specification.version=1.7
        java.vendor=Oracle Corporation
        java.vendor.url=http://java.oracle.com/
        java.vendor.url.bug=http://bugreport.sun.com/bugreport/
        java.version=1.7.0_02-ea
        java.vm.info=mixed mode, sharing
        java.vm.name=Java HotSpot(TM) Client VM
        java.vm.specification.name=Java Virtual Machine Specification
        java.vm.specification.vendor=Oracle Corporation
        java.vm.specification.version=1.7
        java.vm.vendor=Oracle Corporation
        java.vm.version=22.0-b08

ADDITIONAL OS VERSION INFORMATION :
Windows 2003 SP2

EXTRA RELEVANT SYSTEM CONFIGURATION :
User reports his network interfaces to be

lo	(MS TCP Loopback interface)
lo[0]	127.0.0.1
ppp0	(WAN (PPP/SLIP) Interface)
ppp0[0]	79.142.58.41

A DESCRIPTION OF THE PROBLEM :
I have a user of Azureus/Vuze who is reporting a null-pointer exception in  java.net.NetworkInterface.getInterfaceAddresses when trying to enumerate the addresses on his system.

It must be something specific to windows 2003 SP2 and/or his interface setup as I can't reproduce it.

He also reports something similar on 1.6 although I have no trace from that

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
The user can reproduce it always but I can't

See

http://forum.vuze.com/thread.jspa?threadID=100341

if interested (this thread is a mess of varying issues but it is fairly prominent)

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
list of addresses

ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.NullPointerException
	at java.net.NetworkInterface.getInterfaceAddresses(Unknown Source)

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
Not useful
---------- END SOURCE ----------

Comments
reopened as there's an update on the problem: https://bugs.openjdk.java.net/browse/JDK-8023649
23-08-2013

EVALUATION Contacting the submitter for additional information.
14-06-2012

EVALUATION Unfortunately there is no line number information in the snippet of the stacktrace, "Unknown Source". This issue would appear to be specific to the network configuration of this machine, or possibly a badly handled Out Of Memory condition. There is clearly an issue in getInterfaceAddresses() where a reference is unexpectely null. Most of the NetworkInterface implementation is in native code and there must be a path that allows creation of a NetworkInterface instance with a null 'bindings', or InterfaceAddress with a null 'address'. It would help to know if the application encountering this problem is running within a security manager? Running the following simple test on the submitters machine should show the same problem, and may even help identify the cause. ---- source ---- mport java.io.*; import java.net.*; import java.util.*; import static java.lang.System.out; public class ListNetsEx { public static void main(String args[]) throws SocketException { Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces(); for (NetworkInterface netint : Collections.list(nets)) { displayInterfaceInformation(netint); Enumeration<NetworkInterface> subIfs = netint.getSubInterfaces(); for (NetworkInterface subNif : Collections.list(subIfs)) { out.println("SubIF"); displayInterfaceInformation(subNif); } } } static void displayInterfaceInformation(NetworkInterface netint) throws SocketException { out.printf("Display name: %s\n", netint.getDisplayName()); out.printf("Name: %s\n", netint.getName()); Enumeration<InetAddress> inetAddresses = netint.getInetAddresses(); for (InetAddress inetAddress : Collections.list(inetAddresses)) { out.printf("InetAddress: %s\n", inetAddress); } out.printf("Up? %s\n", netint.isUp()); out.printf("Loopback? %s\n", netint.isLoopback()); out.printf("PointToPoint? %s\n", netint.isPointToPoint()); out.printf("Supports multicast? %s\n", netint.supportsMulticast()); out.printf("Virtual? %s\n", netint.isVirtual()); out.printf("Hardware address: %s\n", Arrays.toString(netint.getHardwareAddress())); out.printf("MTU: %s\n", netint.getMTU()); out.printf("Index: %s\n", netint.getIndex()); out.printf("\n"); } } ---- source ----
18-11-2011