Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-1730: fix logging in exception

Grant Ingersolld66ae611930b
diff --git a/solr/core/src/java/org/apache/solr/core/SolrCore.java b/solr/core/src/java/org/apache/solr/core/SolrCore.java
index b8d502504ab..812e8ef956d 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrCore.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java
@@ -613,7 +613,6 @@ public final class SolrCore implements SolrInfoMBean {
resourceLoader.inform( resourceLoader );
resourceLoader.inform( this ); // last call before the latch is released.
} catch (Throwable e) {
- log.error("Error in constructing the core", e);
latch.countDown();//release the latch, otherwise we block trying to do the close. This should be fine, since counting down on a latch of 0 is still fine
//close down the searcher and any other resources, if it exists, as this is not recoverable
close();
diff --git a/solr/core/src/test/org/apache/solr/handler/component/BadComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/BadComponentTest.java
index feffca0aa6a..ae94d3cd6dc 100644
--- a/solr/core/src/test/org/apache/solr/handler/component/BadComponentTest.java
+++ b/solr/core/src/test/org/apache/solr/handler/component/BadComponentTest.java
@@ -30,19 +30,21 @@ public class BadComponentTest extends SolrTestCaseJ4{
@Test
public void testBadElevate() throws Exception {
try {
+ ignoreException(".*constructing.*");
+ ignoreException(".*QueryElevationComponent.*");
System.setProperty("elevate.file", "foo.xml");
initCore("solrconfig-elevate.xml", "schema12.xml");
assertTrue(false);
} catch (RuntimeException e) {
//TODO: better way of checking this?
- if (e.getCause() instanceof SolrException && e.getCause().getCause().getMessage().equals("Error initializing QueryElevationComponent.")){
- log.error("Exception", e);
+ if (e.getCause() instanceof SolrException){
assertTrue(true);
} else {
assertTrue(false);
}
} finally {
System.clearProperty("elevate.file");
+ resetExceptionIgnores();
}
}
}