Apache Solr open-source search software
SOLR-5814: CoreContainer reports incorrect & missleading path for solrconfig.xml when there are loading problems
Chris M. Hostetterf9a2d653b9ab
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 61b27955d31..d851c0566e3 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -167,6 +167,9 @@ Bug Fixes* SOLR-6297: Fix WordBreakSolrSpellChecker to not lose suggestions in shard/cloudenvironments (James Dyer)+* SOLR-5814: CoreContainer reports incorrect & missleading path for solrconfig.xml+ when there are loading problems (Pradeep via hossman)+Other Changes---------------------@@ -186,6 +189,8 @@ Other Changes* SOLR-6073: Remove helper methods from CollectionsRequest (SolrJ) for CollectionsAPIcalls and move to a builder design for the same. (Varun Thacker, Anshum Gupta)++================== 4.10.0 =================Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this releasediff --git a/solr/core/src/java/org/apache/solr/core/SolrConfig.java b/solr/core/src/java/org/apache/solr/core/SolrConfig.javaindex 5b2c0c29624..d88b1a0604b 100644--- a/solr/core/src/java/org/apache/solr/core/SolrConfig.java+++ b/solr/core/src/java/org/apache/solr/core/SolrConfig.java@@ -149,7 +149,7 @@ public class SolrConfig extends Config {return new SolrConfig(loader, name, null);}catch (Exception e) {- String resource = loader.getInstanceDir() + name;+ String resource = loader.getConfigDir() + name;throw new SolrException(ErrorCode.SERVER_ERROR, "Error loading solr config from " + resource, e);}}diff --git a/solr/core/src/java/org/apache/solr/schema/IndexSchema.java b/solr/core/src/java/org/apache/solr/schema/IndexSchema.javaindex d3f1a6c8a13..d992048c438 100644--- a/solr/core/src/java/org/apache/solr/schema/IndexSchema.java+++ b/solr/core/src/java/org/apache/solr/schema/IndexSchema.java@@ -598,11 +598,11 @@ public class IndexSchema {}} catch (SolrException e) {throw new SolrException(ErrorCode.getErrorCode(e.code()), e.getMessage() + ". Schema file is " +- loader.getInstanceDir() + resourceName, e);+ loader.getConfigDir() + resourceName, e);} catch(Exception e) {// unexpected exception...throw new SolrException(ErrorCode.SERVER_ERROR,- "Schema Parsing Failed: " + e.getMessage() + ". Schema file is " + loader.getInstanceDir() + resourceName,+ "Schema Parsing Failed: " + e.getMessage() + ". Schema file is " + loader.getConfigDir() + resourceName,e);}diff --git a/solr/core/src/test/org/apache/solr/core/TestLazyCores.java b/solr/core/src/test/org/apache/solr/core/TestLazyCores.javaindex 73388ebbdfa..81e2d0c3eab 100644--- a/solr/core/src/test/org/apache/solr/core/TestLazyCores.java+++ b/solr/core/src/test/org/apache/solr/core/TestLazyCores.java@@ -17,6 +17,7 @@ package org.apache.solr.core;* limitations under the License.*/+import org.apache.commons.lang.StringUtils;import org.apache.commons.codec.Charsets;import org.apache.commons.io.FileUtils;import org.apache.solr.SolrTestCaseJ4;@@ -498,14 +499,10 @@ public class TestLazyCores extends SolrTestCaseJ4 {// Did we get the expected message for each of the cores that failed to load? Make sure we don't run afoul of// the dreaded slash/backslash difference on Windows and *nix machines.- testMessage(cc.getCoreInitFailures(),- "badConfig1" + File.separator + "solrconfig.xml");- testMessage(cc.getCoreInitFailures(),- "badConfig2" + File.separator + "solrconfig.xml");- testMessage(cc.getCoreInitFailures(),- "badSchema1" + File.separator + "schema.xml");- testMessage(cc.getCoreInitFailures(),- "badSchema2" + File.separator + "schema.xml");+ testMessage(cc.getCoreInitFailures(), makePath("badConfig1", "conf", "solrconfig.xml"));+ testMessage(cc.getCoreInitFailures(), makePath("badConfig2", "conf", "solrconfig.xml"));+ testMessage(cc.getCoreInitFailures(), makePath("badSchema1", "conf", "schema.xml"));+ testMessage(cc.getCoreInitFailures(), makePath("badSchema2", "conf", "schema.xml"));// Status should report that there are failure messages for the bad cores and none for the good cores.checkStatus(cc, true, "core1");@@ -711,6 +708,10 @@ public class TestLazyCores extends SolrTestCaseJ4 {return new LocalSolrQueryRequest(core, new NamedList<>(entries));}+ private static final String makePath(String... args) {+ return StringUtils.join(args, File.separator);+ }+private final static String LOTS_SOLR_XML = " <solr persistent=\"false\"> " +"<cores adminPath=\"/admin/cores\" defaultCoreName=\"collectionLazy2\" transientCacheSize=\"4\"> " +"<core name=\"collection1\" instanceDir=\"collection1\" /> " +