diff --git a/CHANGES.txt b/CHANGES.txt index 2a7c05fb63f..c040bfd0b02 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -349,6 +349,9 @@ Bug Fixes 39. SOLR-1094: Incorrect value of correctlySpelled attribute in some cases (David Smiley, mark Miller via shalin) +40. SOLR-965: Better error message when is not configured. + (Mark Miller via hossman) + Other Changes ---------------------- 1. Upgraded to Lucene 2.4.0 (yonik) diff --git a/src/java/org/apache/solr/core/SolrConfig.java b/src/java/org/apache/solr/core/SolrConfig.java index 7000a9dfcf4..c4996c90ea2 100644 --- a/src/java/org/apache/solr/core/SolrConfig.java +++ b/src/java/org/apache/solr/core/SolrConfig.java @@ -27,6 +27,9 @@ import org.apache.solr.search.FastLRUCache; import org.apache.solr.update.SolrIndexConfig; import org.apache.lucene.search.BooleanQuery; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import org.w3c.dom.Node; import org.xml.sax.SAXException; @@ -48,6 +51,8 @@ import java.io.InputStream; */ public class SolrConfig extends Config { + public static final Logger log = LoggerFactory.getLogger(SolrConfig.class); + public static final String DEFAULT_CONF_FILE = "solrconfig.xml"; /** @@ -202,7 +207,6 @@ public class SolrConfig extends Config { private final NamedList pingQueryParams; static private NamedList readPingQueryParams(SolrConfig config) { - // TODO: check for nested tags and parse as a named list instead String urlSnippet = config.get("admin/pingQuery", "").trim(); StringTokenizer qtokens = new StringTokenizer(urlSnippet,"&"); @@ -213,6 +217,10 @@ public class SolrConfig extends Config { String[] split = tok.split("=", 2); params.add(split[0], split[1]); } + if (0 < params.size()) { + log.warn("The syntax is deprecated, " + + "please use PingRequestHandler instead"); + } return params; } @@ -224,6 +232,11 @@ public class SolrConfig extends Config { */ @Deprecated public SolrQueryRequest getPingQueryRequest(SolrCore core) { + if(pingQueryParams.size() == 0) { + throw new IllegalStateException + (" not configured (consider registering " + + "PingRequestHandler with the name '/admin/ping' instead)"); + } return new LocalSolrQueryRequest(core, pingQueryParams); } diff --git a/src/webapp/web/admin/ping.jsp b/src/webapp/web/admin/ping.jsp index 000aa6c5e9f..3c3ddcbb868 100644 --- a/src/webapp/web/admin/ping.jsp +++ b/src/webapp/web/admin/ping.jsp @@ -37,25 +37,13 @@ if (resp.getException() == null) { // No need for explicit status in the body, when the standard HTTP // response codes already transmit success/failure message -// out.println("200"); + out.println("200"); } else if (resp.getException() != null) { -// No need for explicit status in the body, when the standard HTTP -// response codes already transmit success/failure message -// out.println("500"); - out.println(""); - XML.escapeCharData(SolrException.toStr(resp.getException()), out); - out.println(""); - response.sendError(500); + throw resp.getException(); } } catch (Throwable t) { -// No need for explicit status in the body, when the standard HTTP -// response codes already transmit success/failure message -// out.println("500"); - out.println(""); - XML.escapeCharData(SolrException.toStr(t), out); - out.println(""); - response.sendError(500); + throw t; } finally { req.close(); }