mirror of https://github.com/apache/lucene.git
fix for SOLR-145, some Exceptions were being ignored by RequestHandlers
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@504683 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
28cb43d63b
commit
a3775daf45
|
@ -107,6 +107,9 @@ Bug Fixes
|
||||||
exceptions for missing sort specifications or a sort on a non-indexed
|
exceptions for missing sort specifications or a sort on a non-indexed
|
||||||
field. (Ryan McKinley via yonik)
|
field. (Ryan McKinley via yonik)
|
||||||
|
|
||||||
|
4. SOLR-145: Fix for bug introduced in SOLR-104 where some Exceptions
|
||||||
|
were being ignored by all "out of the box" RequestHandlers. (hossman)
|
||||||
|
|
||||||
Other Changes
|
Other Changes
|
||||||
1.
|
1.
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.solr.handler;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
|
import org.apache.solr.core.SolrCore;
|
||||||
import org.apache.solr.core.SolrException;
|
import org.apache.solr.core.SolrException;
|
||||||
import org.apache.solr.core.SolrInfoMBean;
|
import org.apache.solr.core.SolrInfoMBean;
|
||||||
import org.apache.solr.request.SolrParams;
|
import org.apache.solr.request.SolrParams;
|
||||||
|
@ -74,12 +75,9 @@ public abstract class RequestHandlerBase implements SolrRequestHandler, SolrInfo
|
||||||
try {
|
try {
|
||||||
U.setDefaults(req,defaults,appends,invariants);
|
U.setDefaults(req,defaults,appends,invariants);
|
||||||
handleRequestBody( req, rsp );
|
handleRequestBody( req, rsp );
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch( SolrException se ) {
|
SolrException.log(SolrCore.log,e);
|
||||||
numErrors++;
|
rsp.setException(e);
|
||||||
throw se;
|
|
||||||
}
|
|
||||||
catch( Exception e) {
|
|
||||||
numErrors++;
|
numErrors++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import org.apache.lucene.search.Query;
|
||||||
import org.apache.lucene.search.BooleanQuery;
|
import org.apache.lucene.search.BooleanQuery;
|
||||||
import org.apache.solr.core.SolrCore;
|
import org.apache.solr.core.SolrCore;
|
||||||
import org.apache.solr.search.*;
|
import org.apache.solr.search.*;
|
||||||
|
import org.apache.solr.handler.*;
|
||||||
import org.apache.solr.request.*;
|
import org.apache.solr.request.*;
|
||||||
import org.apache.solr.util.*;
|
import org.apache.solr.util.*;
|
||||||
import org.apache.solr.schema.*;
|
import org.apache.solr.schema.*;
|
||||||
|
@ -143,6 +144,27 @@ public class BasicFunctionalityTest extends AbstractSolrTestCase {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testRequestHandlerBaseException() {
|
||||||
|
final String tmp = "BOO!";
|
||||||
|
SolrRequestHandler handler = new RequestHandlerBase() {
|
||||||
|
public String getDescription() { return tmp; }
|
||||||
|
public String getSourceId() { return tmp; }
|
||||||
|
public String getSource() { return tmp; }
|
||||||
|
public String getVersion() { return tmp; }
|
||||||
|
public void handleRequestBody
|
||||||
|
( SolrQueryRequest req, SolrQueryResponse rsp ) {
|
||||||
|
throw new RuntimeException(tmp);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
handler.init(new NamedList());
|
||||||
|
SolrQueryResponse rsp = new SolrQueryResponse();
|
||||||
|
h.getCore().execute(handler,
|
||||||
|
new LocalSolrQueryRequest(h.getCore(),
|
||||||
|
new NamedList()),
|
||||||
|
rsp);
|
||||||
|
assertNotNull("should have found an exception", rsp.getException());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void testMultipleUpdatesPerAdd() {
|
public void testMultipleUpdatesPerAdd() {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue