SOLR-2367: use ignoreException for DIH tests that expect exceptions

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1071594 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2011-02-17 12:26:11 +00:00
parent 28cf54a4cc
commit d964adafe9
5 changed files with 10 additions and 5 deletions

View File

@ -17,6 +17,7 @@
package org.apache.solr.handler.dataimport; package org.apache.solr.handler.dataimport;
import org.apache.solr.common.SolrException;
import org.apache.solr.core.SolrConfig; import org.apache.solr.core.SolrConfig;
import org.apache.solr.core.SolrCore; import org.apache.solr.core.SolrCore;
import org.apache.solr.schema.IndexSchema; import org.apache.solr.schema.IndexSchema;
@ -336,7 +337,7 @@ public class DataImporter {
if (!requestParams.debug) if (!requestParams.debug)
cumulativeStatistics.add(docBuilder.importStatistics); cumulativeStatistics.add(docBuilder.importStatistics);
} catch (Throwable t) { } catch (Throwable t) {
LOG.error("Full Import failed", t); SolrException.log(LOG, "Full Import failed", t);
docBuilder.rollback(); docBuilder.rollback();
} finally { } finally {
setStatus(Status.IDLE); setStatus(Status.IDLE);

View File

@ -17,6 +17,7 @@
package org.apache.solr.handler.dataimport; package org.apache.solr.handler.dataimport;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrInputDocument; import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.core.SolrCore; import org.apache.solr.core.SolrCore;
import static org.apache.solr.handler.dataimport.SolrWriter.LAST_INDEX_KEY; import static org.apache.solr.handler.dataimport.SolrWriter.LAST_INDEX_KEY;
@ -490,7 +491,7 @@ public class DocBuilder {
importStatistics.skipDocCount.getAndIncrement(); importStatistics.skipDocCount.getAndIncrement();
exception = null;//should not propogate up exception = null;//should not propogate up
} else { } else {
LOG.error("Exception while processing: " SolrException.log(LOG, "Exception while processing: "
+ entity.name + " document : " + docWrapper, dihe); + entity.name + " document : " + docWrapper, dihe);
} }
if (dihe.getErrCode() == DataImportHandlerException.SEVERE) if (dihe.getErrCode() == DataImportHandlerException.SEVERE)
@ -649,7 +650,7 @@ public class DocBuilder {
importStatistics.skipDocCount.getAndIncrement(); importStatistics.skipDocCount.getAndIncrement();
doc = null; doc = null;
} else { } else {
LOG.error("Exception while processing: " SolrException.log(LOG, "Exception while processing: "
+ entity.name + " document : " + doc, e); + entity.name + " document : " + doc, e);
} }
if (e.getErrCode() == DataImportHandlerException.SEVERE) if (e.getErrCode() == DataImportHandlerException.SEVERE)

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.solr.handler.dataimport; package org.apache.solr.handler.dataimport;
import org.apache.solr.common.SolrException;
import static org.apache.solr.handler.dataimport.DataImportHandlerException.*; import static org.apache.solr.handler.dataimport.DataImportHandlerException.*;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -79,7 +80,7 @@ public class EntityProcessorBase extends EntityProcessor {
rowIterator = null; rowIterator = null;
return null; return null;
} catch (Exception e) { } catch (Exception e) {
log.error("getNext() failed for query '" + query + "'", e); SolrException.log(log, "getNext() failed for query '" + query + "'", e);
query = null; query = null;
rowIterator = null; rowIterator = null;
wrapAndThrow(DataImportHandlerException.WARN, e); wrapAndThrow(DataImportHandlerException.WARN, e);

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.solr.handler.dataimport; package org.apache.solr.handler.dataimport;
import org.apache.solr.common.SolrException;
import static org.apache.solr.handler.dataimport.DataImportHandlerException.*; import static org.apache.solr.handler.dataimport.DataImportHandlerException.*;
import static org.apache.solr.handler.dataimport.EntityProcessorBase.*; import static org.apache.solr.handler.dataimport.EntityProcessorBase.*;
import static org.apache.solr.handler.dataimport.EntityProcessorBase.SKIP; import static org.apache.solr.handler.dataimport.EntityProcessorBase.SKIP;
@ -240,7 +241,7 @@ public class EntityProcessorWrapper extends EntityProcessor {
wrapAndThrow(SEVERE, e); wrapAndThrow(SEVERE, e);
} else { } else {
//SKIP is not really possible. If this calls the nextRow() again the Entityprocessor would be in an inconisttent state //SKIP is not really possible. If this calls the nextRow() again the Entityprocessor would be in an inconisttent state
log.error("Exception in entity : "+ entityName, e); SolrException.log(log, "Exception in entity : "+ entityName, e);
return null; return null;
} }
} }

View File

@ -37,6 +37,7 @@ public class TestErrorHandling extends AbstractDataImportHandlerTestCase {
@BeforeClass @BeforeClass
public static void beforeClass() throws Exception { public static void beforeClass() throws Exception {
initCore("dataimport-solrconfig.xml", "dataimport-schema.xml"); initCore("dataimport-solrconfig.xml", "dataimport-schema.xml");
ignoreException("Unexpected close tag");
} }
@Before @Override @Before @Override