Apache Lucene open-source search software
Fixes for SOLR-3032. Removed all the conditional logging for exceptions, we'll rely on the top levels to log the errors appropriately.
Erick Erickson23bd21c968bd
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 84ddd449a44..f56359c407b 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -390,6 +390,12 @@ Other Changes* SOLR-2607: Removed deprecated client/ruby directory, which included solr-ruby and flare.(ehatcher)++* Solr-3032: logOnce from SolrException logOnce and all the supporting+ structure is gone. abortOnConfugrationError is also gone as it is no longer referenced.+ Errors should be caught and logged at the top-most level or logged and NOT propagated up the+ chain. (Erick Erickson)+Documentation----------------------@@ -477,6 +483,10 @@ Other ChangesAppendedSolrParams into factory methods.(David Smiley via hossman)+* Solr-3032: Deprecate logOnce from SolrException logOnce and all the supporting+ structure will disappear in 4.0. Errors should be caught and logged at the+ top-most level or logged and NOT propagated up the chain. (Erick Erickson)+Build----------------------* SOLR-2487: Add build target to package war without slf4j jars (janhoy)diff --git a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataImportHandler.java b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataImportHandler.javaindex 8b01ace965a..15997b9bd8f 100644--- a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataImportHandler.java+++ b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataImportHandler.java@@ -115,7 +115,6 @@ public class DataImportHandler extends RequestHandlerBase implements}}} catch (Throwable e) {- SolrConfig.severeErrors.add(e);LOG.error( DataImporter.MSG.LOAD_EXP, e);throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,DataImporter.MSG.INVALID_CONFIG, e);diff --git a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataImporter.java b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataImporter.javaindex 542deb3ed56..8239f333670 100644--- a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataImporter.java+++ b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataImporter.java@@ -225,7 +225,6 @@ public class DataImporter {config.readFromXml((Element) elems.item(0));LOG.info("Data Configuration loaded successfully");} catch (Exception e) {- SolrConfig.severeErrors.add(e);throw new DataImportHandlerException(SEVERE,"Exception occurred while initializing context", e);}diff --git a/solr/core/src/java/org/apache/solr/analysis/PhoneticFilterFactory.java b/solr/core/src/java/org/apache/solr/analysis/PhoneticFilterFactory.javaindex 6ae0bf3a589..d45263f446d 100644--- a/solr/core/src/java/org/apache/solr/analysis/PhoneticFilterFactory.java+++ b/solr/core/src/java/org/apache/solr/analysis/PhoneticFilterFactory.java@@ -111,7 +111,7 @@ public class PhoneticFilterFactory extends BaseTokenFilterFactory}}catch (Exception e) {- throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "Error initializing: "+name + "/"+clazz, e , false);+ throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "Error initializing: "+name + "/"+clazz, e);}}diff --git a/solr/core/src/java/org/apache/solr/core/Config.java b/solr/core/src/java/org/apache/solr/core/Config.javaindex 60440e31c36..b5e8c3154fe 100644--- a/solr/core/src/java/org/apache/solr/core/Config.java+++ b/solr/core/src/java/org/apache/solr/core/Config.java@@ -182,7 +182,7 @@ public class Config {return o;} catch (XPathExpressionException e) {- throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Error in xpath:" + path +" for " + name,e,false);+ throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Error in xpath:" + path +" for " + name,e);}}@@ -208,12 +208,12 @@ public class Config {} catch (XPathExpressionException e) {SolrException.log(log,"Error in xpath",e);- throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Error in xpath:" + xstr + " for " + name,e,false);+ throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Error in xpath:" + xstr + " for " + name,e);} catch (SolrException e) {throw(e);} catch (Throwable e) {SolrException.log(log,"Error in xpath",e);- throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Error in xpath:" + xstr+ " for " + name,e,false);+ throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Error in xpath:" + xstr+ " for " + name,e);}}@@ -306,7 +306,7 @@ public class Config {throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,"Invalid luceneMatchVersion '" + matchVersion +"', valid values are: " + Arrays.toString(Version.values()) +- " or a string in format 'V.V'", iae, false);+ " or a string in format 'V.V'", iae);}if (version == Version.LUCENE_CURRENT && !versionWarningAlreadyLogged.getAndSet(true)) {diff --git a/solr/core/src/java/org/apache/solr/core/CoreContainer.java b/solr/core/src/java/org/apache/solr/core/CoreContainer.javaindex a1ee272a7fc..5ad878d568d 100644--- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java+++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java@@ -206,25 +206,6 @@ public class CoreContainerprotected String solrConfigFilename = null;protected String dataDir = null; // override datadir for single core mode- /**- * @deprecated all cores now abort on configuration error regardless of configuration- */- @Deprecated- public boolean isAbortOnConfigurationError() {- return true;- }-- /**- * @deprecated all cores now abort on configuration error regardless of configuration- */- @Deprecated- public void setAbortOnConfigurationError(boolean abortOnConfigurationError) {- if (false == abortOnConfigurationError)- throw new SolrException- (SolrException.ErrorCode.SERVER_ERROR,- "Setting abortOnConfigurationError==false is no longer supported");- }-// core container instantiationpublic CoreContainer initialize() throws IOException,ParserConfigurationException, SAXException {@@ -353,8 +334,7 @@ public class CoreContainertry {containerProperties = readProperties(cfg, ((NodeList) cfg.evaluate("solr", XPathConstants.NODESET)).item(0));} catch (Throwable e) {- SolrConfig.severeErrors.add(e);- SolrException.logOnce(log,null,e);+ SolrException.log(log,null,e);}NodeList nodes = (NodeList)cfg.evaluate("solr/cores/core", XPathConstants.NODESET);@@ -410,8 +390,7 @@ public class CoreContainerregister(name, core, false);}catch (Throwable ex) {- SolrConfig.severeErrors.add( ex );- SolrException.logOnce(log,null,ex);+ SolrException.log(log,null,ex);}}diff --git a/solr/core/src/java/org/apache/solr/core/RequestHandlers.java b/solr/core/src/java/org/apache/solr/core/RequestHandlers.javaindex 93def29976e..587fc51e603 100644--- a/solr/core/src/java/org/apache/solr/core/RequestHandlers.java+++ b/solr/core/src/java/org/apache/solr/core/RequestHandlers.java@@ -169,11 +169,8 @@ final class RequestHandlers {}log.info("created "+info.name+": " + info.className);} catch (Exception ex) {- SolrConfig.severeErrors.add( ex );- SolrException e = new SolrException+ throw new SolrException(ErrorCode.SERVER_ERROR, "RequestHandler init failure", ex);- SolrException.logOnce(log,null,e);- throw e;}}diff --git a/solr/core/src/java/org/apache/solr/core/SolrConfig.java b/solr/core/src/java/org/apache/solr/core/SolrConfig.javaindex 4128d13036a..dad4a1953cb 100644--- a/solr/core/src/java/org/apache/solr/core/SolrConfig.java+++ b/solr/core/src/java/org/apache/solr/core/SolrConfig.java@@ -69,14 +69,6 @@ public class SolrConfig extends Config {public static final String DEFAULT_CONF_FILE = "solrconfig.xml";- /**- * Singleton keeping track of configuration errors- *- * @deprecated All exceptions encountered during config parsing are now thrown by the respective constructors, preventing initialization.- */- @Deprecated- public static final Collection<Throwable> severeErrors = new HashSet<Throwable>();-/** Creates a default instance from the solrconfig.xml. */public SolrConfig()throws ParserConfigurationException, IOException, SAXException {diff --git a/solr/core/src/java/org/apache/solr/core/SolrCore.java b/solr/core/src/java/org/apache/solr/core/SolrCore.javaindex 910f707e289..cce442d9382 100644--- a/solr/core/src/java/org/apache/solr/core/SolrCore.java+++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java@@ -414,7 +414,7 @@ public final class SolrCore implements SolrInfoMBean {} catch (SolrException e) {throw e;} catch (Exception e) {- throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,"Error Instantiating "+msg+", "+className+ " failed to instantiate " +cast.getName(), e, false);+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,"Error Instantiating "+msg+", "+className+ " failed to instantiate " +cast.getName(), e);}}@@ -436,11 +436,11 @@ public final class SolrCore implements SolrInfoMBean {return (T)con.newInstance(this, updateHandler);}}- throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,"Error Instantiating "+msg+", "+className+ " could not find proper constructor for " +class1.getName(), false);+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,"Error Instantiating "+msg+", "+className+ " could not find proper constructor for " +class1.getName());} catch (SolrException e) {throw e;} catch (Exception e) {- throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,"Error Instantiating "+msg+", "+className+ " failed to instantiate " +class1.getName(), e, false);+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,"Error Instantiating "+msg+", "+className+ " failed to instantiate " +class1.getName(), e);}}@@ -616,7 +616,7 @@ public final class SolrCore implements SolrInfoMBean {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 recoverableclose();- throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, null, e, false);+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, null, e);} finally {// allow firstSearcher events to fire and make sure it is releasedlatch.countDown();@@ -1099,7 +1099,7 @@ public final class SolrCore implements SolrInfoMBean {String msg="Error opening new searcher. exceeded limit of maxWarmingSearchers="+maxWarmingSearchers + ", try again later.";log.warn(logid+""+ msg);// HTTP 503==service unavailable, or 409==Conflict- throw new SolrException(SolrException.ErrorCode.SERVICE_UNAVAILABLE,msg,true);+ throw new SolrException(SolrException.ErrorCode.SERVICE_UNAVAILABLE,msg);} else if (onDeckSearchers > 1) {log.info(logid+"PERFORMANCE WARNING: Overlapping onDeckSearchers=" + onDeckSearchers);}@@ -1220,7 +1220,7 @@ public final class SolrCore implements SolrInfoMBean {try {newSearcher.warm(currSearcher);} catch (Throwable e) {- SolrException.logOnce(log,null,e);+ SolrException.log(log, null, e);}return null;}@@ -1248,7 +1248,7 @@ public final class SolrCore implements SolrInfoMBean {listener.newSearcher(newSearcher,null);}} catch (Throwable e) {- SolrException.logOnce(log,null,e);+ SolrException.log(log, null, e);}return null;}@@ -1276,7 +1276,7 @@ public final class SolrCore implements SolrInfoMBean {listener.newSearcher(newSearcher, currSearcher);}} catch (Throwable e) {- SolrException.logOnce(log,null,e);+ SolrException.log(log, null, e);}return null;}@@ -1309,7 +1309,7 @@ public final class SolrCore implements SolrInfoMBean {decrementOnDeckCount[0]=false;registerSearcher(newSearchHolder);} catch (Throwable e) {- SolrException.logOnce(log,null,e);+ SolrException.log(log, null, e);} finally {// we are all done with the old searcher we used// for warming...@@ -1340,7 +1340,7 @@ public final class SolrCore implements SolrInfoMBean {return returnSearcher ? newSearchHolder : null;} catch (Exception e) {- SolrException.logOnce(log,null,e);+ SolrException.log(log, null, e);if (currSearcherHolder != null) currSearcherHolder.decref();synchronized (searcherLock) {@@ -1454,7 +1454,7 @@ public final class SolrCore implements SolrInfoMBean {if (log.isWarnEnabled()) log.warn(logid + msg + ":" + req);- throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, msg, true);+ throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, msg);}// setup response header and handle requestfinal NamedList<Object> responseHeader = new SimpleOrderedMap<Object>();@@ -1525,7 +1525,7 @@ public final class SolrCore implements SolrInfoMBean {final public static void log(Throwable e) {- SolrException.logOnce(log,null,e);+ SolrException.log(log, null, e);}@@ -1579,11 +1579,8 @@ public final class SolrCore implements SolrInfoMBean {}log.info("created "+info.name+": " + info.className);} catch (Exception ex) {- SolrConfig.severeErrors.add( ex );- SolrException e = new SolrException+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "QueryResponseWriter init failure", ex);- SolrException.logOnce(log,null,e);- throw e;}}diff --git a/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java b/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.javaindex 1553cf0df59..302c317ec2e 100644--- a/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java+++ b/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java@@ -406,7 +406,7 @@ public class SolrResourceLoader implements ResourceLoader}}- throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "Error loading class '" + cname + "'", e, false);+ throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "Error loading class '" + cname + "'", e);}finally{//cache the shortname vs FQN if it is loaded by the webapp classloader and it is loaded// using a shortname@@ -424,7 +424,7 @@ public class SolrResourceLoader implements ResourceLoaderClass clazz = findClass(cname,subpackages);if( clazz == null ) {throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,- "Can not find class: "+cname + " in " + classLoader, false);+ "Can not find class: "+cname + " in " + classLoader);}Object obj = null;@@ -433,7 +433,7 @@ public class SolrResourceLoader implements ResourceLoader}catch (Exception e) {throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,- "Error instantiating class: '" + clazz.getName()+"'", e, false );+ "Error instantiating class: '" + clazz.getName()+"'", e);}if (!live) {@@ -457,7 +457,7 @@ public class SolrResourceLoader implements ResourceLoaderClass clazz = findClass(cname,subpackages);if( clazz == null ) {throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,- "Can not find class: "+cname + " in " + classLoader, false);+ "Can not find class: "+cname + " in " + classLoader);}Object obj = null;@@ -467,7 +467,7 @@ public class SolrResourceLoader implements ResourceLoader}catch (Exception e) {throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,- "Error instantiating class: '" + clazz.getName()+"'", e, false );+ "Error instantiating class: '" + clazz.getName()+"'", e);}if (!live) {@@ -488,7 +488,7 @@ public class SolrResourceLoader implements ResourceLoaderClass clazz = findClass(cName,subPackages);if( clazz == null ) {throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,- "Can not find class: "+cName + " in " + classLoader, false);+ "Can not find class: "+cName + " in " + classLoader);}Object obj = null;@@ -499,7 +499,7 @@ public class SolrResourceLoader implements ResourceLoader}catch (Exception e) {throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,- "Error instantiating class: '" + clazz.getName()+"'", e, false );+ "Error instantiating class: '" + clazz.getName()+"'", e);}if (!live) {diff --git a/solr/core/src/java/org/apache/solr/handler/MoreLikeThisHandler.java b/solr/core/src/java/org/apache/solr/handler/MoreLikeThisHandler.javaindex 4ab1e25aa83..5c8d8894781 100644--- a/solr/core/src/java/org/apache/solr/handler/MoreLikeThisHandler.java+++ b/solr/core/src/java/org/apache/solr/handler/MoreLikeThisHandler.java@@ -246,7 +246,7 @@ public class MoreLikeThisHandler extends RequestHandlerBasersp.add("debug", dbgInfo);}} catch (Exception e) {- SolrException.logOnce(SolrCore.log, "Exception during debug", e);+ SolrException.log(SolrCore.log, "Exception during debug", e);rsp.add("exception_during_debug", SolrException.toStr(e));}}diff --git a/solr/core/src/java/org/apache/solr/handler/PingRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/PingRequestHandler.javaindex 81a1594ee93..5013e00a72a 100644--- a/solr/core/src/java/org/apache/solr/handler/PingRequestHandler.java+++ b/solr/core/src/java/org/apache/solr/handler/PingRequestHandler.java@@ -45,7 +45,7 @@ public class PingRequestHandler extends RequestHandlerBase// Check if the service is availableString healthcheck = core.getSolrConfig().get("admin/healthcheck/text()", null );if( healthcheck != null && !new File(healthcheck).exists() ) {- throw new SolrException(SolrException.ErrorCode.SERVICE_UNAVAILABLE, "Service disabled", true);+ throw new SolrException(SolrException.ErrorCode.SERVICE_UNAVAILABLE, "Service disabled");}// Get the RequestHandlerdiff --git a/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java b/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.javaindex bfb58cec684..0ed1de3c7fc 100644--- a/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java+++ b/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java@@ -216,7 +216,7 @@ public class QueryElevationComponent extends SearchComponent implements SolrCore}} catch (Exception ex) {throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,- "Error initializing QueryElevationComponent.", ex, false);+ "Error initializing QueryElevationComponent.", ex);}}diff --git a/solr/core/src/java/org/apache/solr/request/SimpleFacets.java b/solr/core/src/java/org/apache/solr/request/SimpleFacets.javaindex fa9d3c7a0a6..c8fcbbb13dc 100644--- a/solr/core/src/java/org/apache/solr/request/SimpleFacets.java+++ b/solr/core/src/java/org/apache/solr/request/SimpleFacets.java@@ -208,10 +208,8 @@ public class SimpleFacets {facetResponse.add("facet_ranges", getFacetRangeCounts());} catch (IOException e) {- SolrException.logOnce(SolrCore.log, "Exception during facet counts", e);throw new SolrException(ErrorCode.SERVER_ERROR, e);} catch (ParseException e) {- SolrException.logOnce(SolrCore.log, "Exception during facet counts", e);throw new SolrException(ErrorCode.BAD_REQUEST, e);}return facetResponse;diff --git a/solr/core/src/java/org/apache/solr/response/transform/ValueSourceAugmenter.java b/solr/core/src/java/org/apache/solr/response/transform/ValueSourceAugmenter.javaindex f14e8400c46..8d1b9fe75ee 100644--- a/solr/core/src/java/org/apache/solr/response/transform/ValueSourceAugmenter.java+++ b/solr/core/src/java/org/apache/solr/response/transform/ValueSourceAugmenter.java@@ -100,7 +100,7 @@ public class ValueSourceAugmenter extends DocTransformerdoc.setField( name, val );}} catch (IOException e) {- throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "exception at docid " + docid + " for valuesource " + valueSource, e, false);+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "exception at docid " + docid + " for valuesource " + valueSource, e);}}}diff --git a/solr/core/src/java/org/apache/solr/schema/FieldType.java b/solr/core/src/java/org/apache/solr/schema/FieldType.javaindex 4fca55aff99..b40f39f6302 100644--- a/solr/core/src/java/org/apache/solr/schema/FieldType.java+++ b/solr/core/src/java/org/apache/solr/schema/FieldType.java@@ -246,7 +246,7 @@ public abstract class FieldType extends FieldProperties {try {val = toInternal(value.toString());} catch (RuntimeException e) {- throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "Error while creating field '" + field + "' from value '" + value + "'", e, false);+ throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "Error while creating field '" + field + "' from value '" + value + "'", e);}if (val==null) return null;@@ -465,12 +465,10 @@ public abstract class FieldType extends FieldProperties {* @see #getAnalyzer*/public void setAnalyzer(Analyzer analyzer) {- SolrException e = new SolrException+ throw new SolrException(ErrorCode.SERVER_ERROR,"FieldType: " + this.getClass().getSimpleName() +" (" + typeName + ") does not support specifying an analyzer");- SolrException.logOnce(log,null,e);- throw e;}/**@@ -487,12 +485,10 @@ public abstract class FieldType extends FieldProperties {* @see #getQueryAnalyzer*/public void setQueryAnalyzer(Analyzer analyzer) {- SolrException e = new SolrException+ throw new SolrException(ErrorCode.SERVER_ERROR,"FieldType: " + this.getClass().getSimpleName() +" (" + typeName + ") does not support specifying an analyzer");- SolrException.logOnce(log,null,e);- throw e;}/** @lucene.internal */diff --git a/solr/core/src/java/org/apache/solr/schema/IndexSchema.java b/solr/core/src/java/org/apache/solr/schema/IndexSchema.javaindex 1325397a37e..203cd816008 100644--- a/solr/core/src/java/org/apache/solr/schema/IndexSchema.java+++ b/solr/core/src/java/org/apache/solr/schema/IndexSchema.java@@ -386,7 +386,7 @@ public final class IndexSchema {FieldType ft = fieldTypes.get(type);if (ft==null) {- throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Unknown fieldtype '" + type + "' specified on field " + name,false);+ throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Unknown fieldtype '" + type + "' specified on field " + name);}Map<String,String> args = DOMUtil.toMapExcept(attrs, "name", "type");@@ -401,10 +401,7 @@ public final class IndexSchema {if( old != null ) {String msg = "[schema.xml] Duplicate field definition for '"+ f.getName() + "' [[["+old.toString()+"]]] and [[["+f.toString()+"]]]";- SolrException t = new SolrException(SolrException.ErrorCode.SERVER_ERROR, msg );- SolrException.logOnce(log,null,t);- SolrConfig.severeErrors.add( t );- throw t;+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, msg );}log.debug("field defined: " + f);if( f.getDefaultValue() != null ) {@@ -553,12 +550,10 @@ public final class IndexSchema {aware.inform(this);}} catch (SolrException e) {- SolrConfig.severeErrors.add( e );throw e;} catch(Exception e) {// unexpected exception...- SolrConfig.severeErrors.add( e );- throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Schema Parsing Failed: " + e.getMessage(), e,false);+ throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Schema Parsing Failed: " + e.getMessage(), e);}// create the field analyzers@@ -574,10 +569,7 @@ public final class IndexSchema {String msg = "[schema.xml] Duplicate DynamicField definition for '"+ f.getName() + "'";- SolrException t = new SolrException(SolrException.ErrorCode.SERVER_ERROR, msg);- SolrException.logOnce(log, null, t);- SolrConfig.severeErrors.add(t);- throw t;+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, msg);}}diff --git a/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java b/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.javaindex e4c0ff6c93c..2f0c0b29a4b 100644--- a/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java+++ b/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java@@ -84,44 +84,20 @@ public class SolrDispatchFilter implements Filter{log.info("SolrDispatchFilter.init()");- boolean abortOnConfigurationError = true;CoreContainer.Initializer init = createInitializer();try {// web.xml configurationthis.pathPrefix = config.getInitParameter( "path-prefix" );this.cores = init.initialize();- abortOnConfigurationError = init.isAbortOnConfigurationError();log.info("user.dir=" + System.getProperty("user.dir"));}catch( Throwable t ) {// catch this so our filter still works- log.error( "Could not start Solr. Check solr/home property and the logs", t);- SolrConfig.severeErrors.add( t );+ log.error( "Could not start Solr. Check solr/home property and the logs");SolrCore.log( t );}- // Optionally abort if we found a sever error- if( abortOnConfigurationError && SolrConfig.severeErrors.size() > 0 ) {- StringWriter sw = new StringWriter();- PrintWriter out = new PrintWriter( sw );- out.println( "Severe errors in solr configuration.\n" );- out.println( "Check your log files for more detailed information on what may be wrong.\n" );- for( Throwable t : SolrConfig.severeErrors ) {- out.println( "-------------------------------------------------------------" );- t.printStackTrace( out );- }- out.flush();-- // Servlet containers behave slightly differently if you throw an exception during- // initialization. Resin will display that error for every page, jetty prints it in- // the logs, but continues normally. (We will see a 404 rather then the real error)- // rather then leave the behavior undefined, lets cache the error and spit it out- // for every request.- abortErrorMessage = sw.toString();- //throw new ServletException( abortErrorMessage );- }-log.info("SolrDispatchFilter.init() done");}@@ -366,7 +342,7 @@ public class SolrDispatchFilter implements Filterex.printStackTrace(new PrintWriter(sw));trace = "\n\n"+sw.toString();- SolrException.logOnce(log,null,ex );+ SolrException.log(log, null, ex);// non standard codes have undefined results with various serversif( code < 100 ) {diff --git a/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java b/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.javaindex 018aad3280c..df86e84d0d1 100644--- a/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java+++ b/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java@@ -573,7 +573,7 @@ public class DirectUpdateHandler2 extends UpdateHandler {try {solrCoreState.decref();} catch (IOException e) {- throw new SolrException(ErrorCode.SERVER_ERROR, "", e, false);+ throw new SolrException(ErrorCode.SERVER_ERROR, "", e);}}diff --git a/solr/core/src/java/org/apache/solr/util/plugin/AbstractPluginLoader.java b/solr/core/src/java/org/apache/solr/util/plugin/AbstractPluginLoader.javaindex 635960cfe2e..74f1800aca9 100644--- a/solr/core/src/java/org/apache/solr/util/plugin/AbstractPluginLoader.java+++ b/solr/core/src/java/org/apache/solr/util/plugin/AbstractPluginLoader.java@@ -167,8 +167,6 @@ public abstract class AbstractPluginLoader<T>SolrException e = new SolrException(ErrorCode.SERVER_ERROR,"Plugin init failure for " + type + ":" + ex.getMessage(), ex);- SolrConfig.severeErrors.add( e );- SolrException.logOnce(log,null,e);throw e;}}@@ -182,8 +180,6 @@ public abstract class AbstractPluginLoader<T>catch( Exception ex ) {SolrException e = new SolrException(ErrorCode.SERVER_ERROR, "Plugin Initializing failure for " + type, ex);- SolrConfig.severeErrors.add( e );- SolrException.logOnce(log,null,e);throw e;}}@@ -232,8 +228,6 @@ public abstract class AbstractPluginLoader<T>} catch (Exception ex) {SolrException e = new SolrException(ErrorCode.SERVER_ERROR, "Plugin init failure for " + type, ex);- SolrConfig.severeErrors.add( e );- SolrException.logOnce(log,null,e);throw e;}@@ -244,8 +238,6 @@ public abstract class AbstractPluginLoader<T>} catch (Exception ex) {SolrException e = new SolrException(ErrorCode.SERVER_ERROR, "Plugin init failure for " + type, ex);- SolrConfig.severeErrors.add( e );- SolrException.logOnce(log,null,e);throw e;}}diff --git a/solr/core/src/test/org/apache/solr/cloud/AbstractDistributedZkTestCase.java b/solr/core/src/test/org/apache/solr/cloud/AbstractDistributedZkTestCase.javaindex e7ced578ee8..e3008a4b5e7 100644--- a/solr/core/src/test/org/apache/solr/cloud/AbstractDistributedZkTestCase.java+++ b/solr/core/src/test/org/apache/solr/cloud/AbstractDistributedZkTestCase.java@@ -82,7 +82,6 @@ public abstract class AbstractDistributedZkTestCase extends BaseDistributedSearcSystem.clearProperty("solr.test.sys.prop2");super.tearDown();resetExceptionIgnores();- SolrConfig.severeErrors.clear();}protected void printLayout() throws Exception {diff --git a/solr/core/src/test/org/apache/solr/cloud/AbstractZkTestCase.java b/solr/core/src/test/org/apache/solr/cloud/AbstractZkTestCase.javaindex f7660f05cf0..f3f6421737e 100644--- a/solr/core/src/test/org/apache/solr/cloud/AbstractZkTestCase.java+++ b/solr/core/src/test/org/apache/solr/cloud/AbstractZkTestCase.java@@ -105,7 +105,6 @@ public abstract class AbstractZkTestCase extends SolrTestCaseJ4 {printLayout(zkServer.getZkHost());}- SolrConfig.severeErrors.clear();super.tearDown();}diff --git a/solr/core/src/test/org/apache/solr/cloud/CloudStateUpdateTest.java b/solr/core/src/test/org/apache/solr/cloud/CloudStateUpdateTest.javaindex e8fe037612d..9d43d5a6177 100644--- a/solr/core/src/test/org/apache/solr/cloud/CloudStateUpdateTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/CloudStateUpdateTest.java@@ -312,7 +312,6 @@ public class CloudStateUpdateTest extends SolrTestCaseJ4 {System.clearProperty("zkHost");System.clearProperty("hostPort");System.clearProperty("CLOUD_UPDATE_DELAY");- SolrConfig.severeErrors.clear();}private void addShardToZk(SolrZkClient zkClient, String shardsPath,diff --git a/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java b/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.javaindex 74d9053946e..630ed47d22f 100644--- a/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java@@ -219,7 +219,6 @@ public class ZkControllerTest extends SolrTestCaseJ4 {@Overridepublic void tearDown() throws Exception {- SolrConfig.severeErrors.clear();super.tearDown();}}diff --git a/solr/core/src/test/org/apache/solr/cloud/ZkSolrClientTest.java b/solr/core/src/test/org/apache/solr/cloud/ZkSolrClientTest.javaindex 4ad0aa8bd66..28959a36da2 100644--- a/solr/core/src/test/org/apache/solr/cloud/ZkSolrClientTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/ZkSolrClientTest.java@@ -234,7 +234,6 @@ public class ZkSolrClientTest extends AbstractSolrTestCase {@Overridepublic void tearDown() throws Exception {- SolrConfig.severeErrors.clear();super.tearDown();}diff --git a/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java b/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.javaindex 0cbd1748b39..1076a327402 100644--- a/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java+++ b/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java@@ -45,7 +45,6 @@ public class BadIndexSchemaTest extends SolrTestCaseJ4 {(ErrorCode.SERVER_ERROR,"Unexpected error, expected error matching: " + errString, e);} finally {- SolrConfig.severeErrors.clear();deleteCore();}fail("Did not encounter any exception from: " + schema);diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CommonsHttpSolrServer.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CommonsHttpSolrServer.javaindex 36c806744b7..e68ec6171f5 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CommonsHttpSolrServer.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CommonsHttpSolrServer.java@@ -427,7 +427,7 @@ public class CommonsHttpSolrServer extends SolrServermsg.append( method.getStatusText() );msg.append( "\n\n" );msg.append( "request: "+method.getURI() );- throw new SolrException(statusCode, java.net.URLDecoder.decode(msg.toString(), "UTF-8") );+ throw new SolrException(SolrException.ErrorCode.getErrorCode(statusCode), java.net.URLDecoder.decode(msg.toString(), "UTF-8") );}// Read the contentsdiff --git a/solr/solrj/src/java/org/apache/solr/common/SolrException.java b/solr/solrj/src/java/org/apache/solr/common/SolrException.javaindex ca52a78faf8..5bf4d5c400d 100644--- a/solr/solrj/src/java/org/apache/solr/common/SolrException.java+++ b/solr/solrj/src/java/org/apache/solr/common/SolrException.java@@ -54,52 +54,25 @@ public class SolrException extends RuntimeException {return UNKNOWN;}};-- public boolean logged=false;public SolrException(ErrorCode code, String msg) {- this(code, msg, null, false);- }-- public SolrException(ErrorCode code, String msg, boolean alreadyLogged) {- this(code, msg, null, alreadyLogged);- }-- public SolrException(ErrorCode code, String msg, Throwable th, boolean alreadyLogged) {- super(msg,th);- this.code=code.code;- logged=alreadyLogged;+ this(code, msg, null);}-public SolrException(ErrorCode code, String msg, Throwable th) {- this(code, msg, th, (th instanceof SolrException) ? ((SolrException)th).logged : false);+ super(msg, th);+ this.code = code.code;}public SolrException(ErrorCode code, Throwable th) {- this(code, null, th, (th instanceof SolrException) ? ((SolrException)th).logged : false);- }-- /**- * @deprecated Use {@link #SolrException(ErrorCode,String)}.- */- @Deprecated- public SolrException(int code, String msg) {- super(msg);- this.code=code;+ this(code, null, th);}-int code=0;public int code() { return code; }--public void log(Logger log) { log(log,this); }public static void log(Logger log, Throwable e) {- if (e instanceof SolrException) {- ((SolrException)e).logged = true;- }String stackTrace = toStr(e);String ignore = doIgnore(stackTrace);if (ignore != null) {@@ -111,9 +84,6 @@ public class SolrException extends RuntimeException {}public static void log(Logger log, String msg, Throwable e) {- if (e instanceof SolrException) {- ((SolrException)e).logged = true;- }String stackTrace = msg + ':' + toStr(e);String ignore = doIgnore(stackTrace);if (ignore != null) {@@ -123,14 +93,6 @@ public class SolrException extends RuntimeException {log.error(stackTrace);}- public static void logOnce(Logger log, String msg, Throwable e) {- if (e instanceof SolrException) {- if(((SolrException)e).logged) return;- }- if (msg!=null) log(log,msg,e);- else log(log,e);- }-// public String toString() { return toStr(this); } // oops, inf loop@Override