[HER-1662] use fully qualified hostname

* WriterPoolProcessor.java, ARCWriterProcessor.java, WARCWriterProcessor.java, InetAddressUtil.java 
    replace all InetAddress.getHostName() with InetAddress.getCanonicalHostName() (for consistency)
This commit is contained in:
gojomo
2009-08-27 23:35:07 +00:00
parent 211cd7c659
commit d253ff1ace
4 changed files with 4 additions and 4 deletions
@@ -95,7 +95,7 @@ public class InetAddressUtil {
InetAddress ia = ee.nextElement();
if (ia != null) {
if (ia.getHostName() != null) {
localNames.add(ia.getHostName());
localNames.add(ia.getCanonicalHostName());
}
if (ia.getHostAddress() != null) {
localNames.add(ia.getHostAddress());
@@ -209,7 +209,7 @@ public class ARCWriterProcessor extends WriterPoolProcessor {
private static String getHostName() {
try {
return InetAddress.getLocalHost().getHostName();
return InetAddress.getLocalHost().getCanonicalHostName();
} catch (UnknownHostException e) {
logger.log(Level.SEVERE, "Could not get local host name.", e);
return "localhost";
@@ -514,7 +514,7 @@ public class WARCWriterProcessor extends WriterPoolProcessor {
try {
InetAddress host = InetAddress.getLocalHost();
record.addLabelValue("ip", host.getHostAddress());
record.addLabelValue("hostname", host.getHostName());
record.addLabelValue("hostname", host.getCanonicalHostName());
} catch (UnknownHostException e) {
logger.log(Level.WARNING,"unable top obtain local crawl engine host",e);
}
@@ -437,7 +437,7 @@ implements Lifecycle {
sfx = sfx.trim();
if (sfx.contains(WriterPoolMember.HOSTNAME_VARIABLE)) { String str = "localhost.localdomain";
try {
str = InetAddress.getLocalHost().getHostName();
str = InetAddress.getLocalHost().getCanonicalHostName();
} catch (UnknownHostException ue) {
logger.severe("Failed getHostAddress for this host: " + ue);
}