#145 NullPointerException in getURLs method

open
Pierre Frisch
networking (37)
5
2013-01-24
2012-12-24
Anonymous
No

I run into a NullPointerException in ServiceInfoImpl.getURLs method. The error seems to appear because of a NULL value inside the _ipv6Addresses Set in ServiceInfoImpl. I've tracked the NULL value back and found where it is added to the Set. It is added by the following line inside the JmDNSImpl.registerService method:
info.addAddress(_localHost.getInet6Address());

Here is the source code of my application (just the main method):
public static void main(String[] args) throws Exception
{
// Create JmDNS service
InetAddress localhost = InetAddress.getLocalHost();
dnsServer = JmDNS.create(localhost);
// Register a test service.
ServiceInfo testService = ServiceInfo.create("TEST", "Test description", 8080,"Test description");
dnsServer.registerService(testService);
serviceUrls = testService.getURLs();
}

Here is my stacktrace:
Exception in thread "main" java.lang.NullPointerException
at javax.jmdns.impl.ServiceInfoImpl.getURLs(ServiceInfoImpl.java:653)
at javax.jmdns.impl.ServiceInfoImpl.getURLs(ServiceInfoImpl.java:630)
at com.roksoft.lopocoso.App.main(App.java:69)

I'm using jmdns-3.4.1.jar on Windows 7 64 Bit. I've also attached a screenshot of the status screen of my Wifi adapter.

Discussion


  • Anonymous
    2012-12-24

    Status of network adapter

     
    Attachments