[jboss-jira] [JBoss JIRA] (JGRP-1404) Protect against ArrayIndexOutOfBoundsException when calling InetAddress.getLocalHost
Bela Ban (Resolved) (JIRA)
jira-events at lists.jboss.org
Mon Jan 2 06:16:09 EST 2012
[ https://issues.jboss.org/browse/JGRP-1404?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bela Ban resolved JGRP-1404.
----------------------------
Resolution: Done
> Protect against ArrayIndexOutOfBoundsException when calling InetAddress.getLocalHost
> ------------------------------------------------------------------------------------
>
> Key: JGRP-1404
> URL: https://issues.jboss.org/browse/JGRP-1404
> Project: JGroups
> Issue Type: Enhancement
> Reporter: Galder Zamarreño
> Assignee: Bela Ban
> Fix For: 3.0.2, 3.1
>
>
> All calls to InetAddress.getLocalHost(*) should be replaced with this code in order to avoid a rather annoying issue with OSX 10.7 and (at least) java version "1.6.0_26":
> {code}InetAddress addr;
> try {
> addr = InetAddress.getLocalHost();
> System.out.println("With localhost access: " + addr);
> } catch (ArrayIndexOutOfBoundsException e) {
> addr = InetAddress.getByName(null);
> System.out.println("With reverse lookup: " + addr);
> }{code}
> The exception is:
> {code}Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
> at java.net.InetAddress.getLocalHost(InetAddress.java:1356){code}
> For more info, see http://stackoverflow.com/questions/7892609/inetaddress-getlocalhost-resolution-on-osx-lion-when-offline
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list