From d66ae611930b061dfd26f1944c92e60e2d07e3bf Mon Sep 17 00:00:00 2001 From: Grant Ingersoll Date: Tue, 13 Dec 2011 14:21:41 +0000 Subject: [PATCH] SOLR-1730: fix logging in exception git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1213706 13f79535-47bb-0310-9956-ffa450edef68 --- solr/core/src/java/org/apache/solr/core/SolrCore.java | 1 - .../org/apache/solr/handler/component/BadComponentTest.java | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) 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(); } } }