Skip to content

Apache Lucene open-source search software

SOLR-4088: Format code and remove tabs

Mark Robert Millere821c3ab6c67
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkController.java b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
index 9edf40f90c6..4bec4b48850 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -360,27 +360,29 @@ public final class ZkController {
private String getHostAddress(String host) throws IOException {
if (host == null) {
- String hostaddress = InetAddress.getLocalHost().getHostAddress();
- //Re-get the IP again for "127.0.0.1", the other case we trust the hosts file is right.
- if("127.0.0.1".equals(hostaddress)){
- Enumeration<NetworkInterface> netInterfaces = null;
- try {
- netInterfaces = NetworkInterface.getNetworkInterfaces();
- while (netInterfaces.hasMoreElements()) {
- NetworkInterface ni = netInterfaces.nextElement();
- Enumeration<InetAddress> ips = ni.getInetAddresses();
- while (ips.hasMoreElements()) {
- InetAddress ip = ips.nextElement();
- if (ip.isSiteLocalAddress()) {
- hostaddress = ip.getHostAddress();
- }
- }
- }
- } catch (Throwable e) {
- SolrException.log(log, "Error while looking for a better host name than 127.0.0.1", e);
+ String hostaddress = InetAddress.getLocalHost().getHostAddress();
+ // Re-get the IP again for "127.0.0.1", the other case we trust the hosts
+ // file is right.
+ if ("127.0.0.1".equals(hostaddress)) {
+ Enumeration<NetworkInterface> netInterfaces = null;
+ try {
+ netInterfaces = NetworkInterface.getNetworkInterfaces();
+ while (netInterfaces.hasMoreElements()) {
+ NetworkInterface ni = netInterfaces.nextElement();
+ Enumeration<InetAddress> ips = ni.getInetAddresses();
+ while (ips.hasMoreElements()) {
+ InetAddress ip = ips.nextElement();
+ if (ip.isSiteLocalAddress()) {
+ hostaddress = ip.getHostAddress();
+ }
}
- }
- host = "http://" + hostaddress;
+ }
+ } catch (Throwable e) {
+ SolrException.log(log,
+ "Error while looking for a better host name than 127.0.0.1", e);
+ }
+ }
+ host = "http://" + hostaddress;
} else {
Matcher m = URL_PREFIX.matcher(host);
if (m.matches()) {