package net.pixelcop.sewer.util;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class NetworkUtil {

  public static final Logger LOG = LoggerFactory.getLogger(NetworkUtil.class);

  private static final String localhost;

  // try to determine local hostname
  static {
    String host = null;
    try {
      // host = InetAddress.getLocalHost().getCanonicalHostName();
      host = InetAddress.getLocalHost().getHostName();
    } catch (UnknownHostException e) {
      LOG.error("Unable to get canonical host name: " + e.getMessage(), e);
      // fallback method
      File hostfile = new File("/etc/hostname");
      if (hostfile.exists()) {
        try {
          host = new BufferedReader(new FileReader(hostfile)).readLine().trim();
        } catch (IOException e1) {
          host = "localhost";
        }
      }
    }
    localhost = host;
  }

  public static final String getLocalhost() {
    return localhost;
  }

}

@@ -1045,16 +1045,108 @@
 t;%0A  %7D%0A%0A
+  /**%0A   * Returns the hostname of the the local machine%0A   * @return String hostname%0A   */%0A
   public

document method