mirror of
https://github.com/internetarchive/heritrix3.git
synced 2026-07-13 11:07:12 +00:00
[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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user