SOLR-1730: fix logging in exception

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1213706 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Grant Ingersoll 2011-12-13 14:21:41 +00:00
parent 7c0069cbb7
commit d66ae61193
2 changed files with 4 additions and 3 deletions

View File

@ -613,7 +613,6 @@ public final class SolrCore implements SolrInfoMBean {
resourceLoader.inform( resourceLoader ); resourceLoader.inform( resourceLoader );
resourceLoader.inform( this ); // last call before the latch is released. resourceLoader.inform( this ); // last call before the latch is released.
} catch (Throwable e) { } 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 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 down the searcher and any other resources, if it exists, as this is not recoverable
close(); close();

View File

@ -30,19 +30,21 @@ public class BadComponentTest extends SolrTestCaseJ4{
@Test @Test
public void testBadElevate() throws Exception { public void testBadElevate() throws Exception {
try { try {
ignoreException(".*constructing.*");
ignoreException(".*QueryElevationComponent.*");
System.setProperty("elevate.file", "foo.xml"); System.setProperty("elevate.file", "foo.xml");
initCore("solrconfig-elevate.xml", "schema12.xml"); initCore("solrconfig-elevate.xml", "schema12.xml");
assertTrue(false); assertTrue(false);
} catch (RuntimeException e) { } catch (RuntimeException e) {
//TODO: better way of checking this? //TODO: better way of checking this?
if (e.getCause() instanceof SolrException && e.getCause().getCause().getMessage().equals("Error initializing QueryElevationComponent.")){ if (e.getCause() instanceof SolrException){
log.error("Exception", e);
assertTrue(true); assertTrue(true);
} else { } else {
assertTrue(false); assertTrue(false);
} }
} finally { } finally {
System.clearProperty("elevate.file"); System.clearProperty("elevate.file");
resetExceptionIgnores();
} }
} }
} }