determine hostname. Submitted by Joel Tucci.master
@@ -182,6 +182,7 @@ Jesse Glick | |||||
Jesse Stockall | Jesse Stockall | ||||
Jim Allers | Jim Allers | ||||
Joerg Wassmer | Joerg Wassmer | ||||
Joel Tucci | |||||
Joey Richey | Joey Richey | ||||
Johann Herunter | Johann Herunter | ||||
John Elion | John Elion | ||||
@@ -14,6 +14,9 @@ Fixed bugs: | |||||
* TarArchiveInputStream could throw IOException when reading PAX | * TarArchiveInputStream could throw IOException when reading PAX | ||||
headers from a "slow" InputStream. | headers from a "slow" InputStream. | ||||
* XMLJunitResultFormatter could throw NullPointerException if Java | |||||
cannot determine the local hostname. | |||||
Bugzilla Report 56593 | |||||
Other changes: | Other changes: | ||||
-------------- | -------------- | ||||
@@ -751,6 +751,10 @@ | |||||
<first>Joerg</first> | <first>Joerg</first> | ||||
<last>Wassmer</last> | <last>Wassmer</last> | ||||
</name> | </name> | ||||
<name> | |||||
<first>Joel</first> | |||||
<last>Tucci</last> | |||||
</name> | |||||
<name> | <name> | ||||
<first>Joey</first> | <first>Joey</first> | ||||
<last>Richey</last> | <last>Richey</last> | ||||
@@ -161,11 +161,15 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan | |||||
* @return the name of the local host, or "localhost" if we cannot work it out | * @return the name of the local host, or "localhost" if we cannot work it out | ||||
*/ | */ | ||||
private String getHostname() { | private String getHostname() { | ||||
String hostname = "localhost"; | |||||
try { | try { | ||||
return InetAddress.getLocalHost().getHostName(); | |||||
InetAddress localHost = InetAddress.getLocalHost(); | |||||
if (localHost != null) { | |||||
hostname = localHost.getHostName(); | |||||
} | |||||
} catch (UnknownHostException e) { | } catch (UnknownHostException e) { | ||||
return "localhost"; | |||||
} | } | ||||
return hostname; | |||||
} | } | ||||
/** | /** | ||||