Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-481: Handle UnknownHostException

Grant Ingersoll9f25cd201fcb
diff --git a/CHANGES.txt b/CHANGES.txt
index 0dc87b8dd7b..2e4ddadf823 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -253,6 +253,8 @@ Bug Fixes
16. SOLR-42: HTMLStripReader tokenizers now preserve correct source
offsets for highlighting. (Grant Ingersoll via yonik)
+17. SOLR-481: Handle UnknownHostException in _info.jsp (gsingers)
+
Other Changes
1. SOLR-135: Moved common classes to org.apache.solr.common and altered the
build scripts to make two jars: apache-solr-1.3.jar and
diff --git a/src/webapp/resources/admin/_info.jsp b/src/webapp/resources/admin/_info.jsp
index 58362e2a3c0..371f3047b77 100644
--- a/src/webapp/resources/admin/_info.jsp
+++ b/src/webapp/resources/admin/_info.jsp
@@ -23,6 +23,7 @@
<%@ page import="org.apache.solr.core.Config"%>
<%@ page import="org.apache.solr.util.XML"%>
<%@ page import="org.apache.lucene.LucenePackage"%>
+<%@ page import="java.net.UnknownHostException" %>
<%
@@ -46,8 +47,14 @@
}
String collectionName = schema!=null ? schema.getName():"unknown";
- InetAddress addr = InetAddress.getLocalHost();
- String hostname = addr.getCanonicalHostName();
+ InetAddress addr = null;
+ String hostname = "unknown";
+ try {
+ addr = InetAddress.getLocalHost();
+ hostname = addr.getCanonicalHostName();
+ } catch (UnknownHostException e) {
+ //default to unknown
+ }
String defaultSearch = "";
{