This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 234040 - warn user about misconfigured hosts on unix
Summary: warn user about misconfigured hosts on unix
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: JDK Problems (show other bugs)
Version: 7.4
Hardware: PC Mac OS X
: P3 normal (vote)
Assignee: Jan Becicka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-06 20:16 UTC by John Jullion-ceccarelli
Modified: 2015-03-05 13:31 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 202867


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Jullion-ceccarelli 2013-08-06 20:16:07 UTC
I get this every time: 

http://statistics.netbeans.org/analytics/exception.do?id=684996

I have xCode installed on my system, in Options Window -> Mobile Platforms it says 

iOS Code Sign Identity: iPhone Developer
iOS Provisioning Profile: <empty combo box>
Comment 1 John Jullion-ceccarelli 2013-08-07 00:28:04 UTC
Note this isn't with cordova, it's just running the page in the browser.
Comment 2 David Konecny 2013-08-07 01:29:38 UTC
From the exception stack trace it looked like cordova issue - iOS browser is opening some URL and it fails. But after one more look the problem is in WebUtils.getLocalhostInetAddress:530 - it calls java.net.InetAddress.getLocalHost() which fails on your Mac for some reason. This should be unrelated to migration to PhoneGap 3.0 as it is a JDK call. Leaving to Honza for evaluation as he wrote WebUtils.getLocalhostInetAddress method.
Comment 3 Jan Becicka 2013-08-07 07:23:04 UTC
I guess, that it is
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7180557
Comment 4 Antonin Nebuzelsky 2013-08-07 12:01:50 UTC
I asked in the JDK bug for a fix on their side.

Let's look also for a possibility of a workaround.
Comment 5 David Konecny 2013-08-07 20:16:21 UTC
Why would John have this problem and nobody else? PetrJ is using Mac too.
Comment 6 Ondrej Vrabec 2013-08-08 06:25:02 UTC
No idea why that happens just on john's Mac and no idea how hostnames are resolved on Macs. We were not able to reproduce on none of macs here in Prague office. Maybe it's related to jumping from Oracle network (and Oracle DNS services) to home mode (just local DNS resolve). I can reproduce something similar on my Linux but only if i manually edit /etc/hosts and change:
> ::1             localhost ipv6-localhost ipv6-loopback ovrabec.netbeans
to
> ::1             localhost ipv6-localhost ipv6-loopback
Than my machine cannot resolve ovrabec.netbeans either. I checked some of my college's Mac laptops and their config file is almost empty but maybe it could help john to add/modify /etc/hosts:
::1             localhost ipv6-localhost ipv6-loopback jjullion-mac
Comment 7 John Jullion-ceccarelli 2013-08-08 14:01:00 UTC
Content of my /etc/hosts:

##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0     localhost


Adding jjullion-mac to ::1 list solved the problem. How can we intercept these errors and send people to a wiki or give them some help in an error dialog on how to fix it?
Comment 8 Stanislav Aubrecht 2013-08-12 11:40:17 UTC
I suppose this should do, reassigning to the author of WebUtils

# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: D:\hg\core-main
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: web.common/src/org/netbeans/modules/web/common/api/WebUtils.java
--- web.common/src/org/netbeans/modules/web/common/api/WebUtils.java Base (BASE)
+++ web.common/src/org/netbeans/modules/web/common/api/WebUtils.java Locally Modified (Based On LOCAL)
@@ -52,6 +52,7 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.List;
@@ -547,6 +548,9 @@
                 }
             }
             return localHost;
+        } catch ( UnknownHostException uhE) {
+            Logger.getLogger( WebUtils.class.getName() ).log( Level.WARNING, "Cannot resolve local host address, please check your network configuration.", uhE);
+            throw new IllegalStateException(uhE);
         } catch (Exception ex) {
             throw new IllegalStateException(ex);
         }
Comment 9 Jan Stola 2015-03-05 13:31:56 UTC
The JDK bug 7180557 is fixed in JDK 8 (build 113). I have also modified the message of this exception to be more informative => I am closing this issue as fixed.

Modified file: https://hg.netbeans.org/web-main/rev/c6fa61c002c5