You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/08/20 01:33:36 UTC

[lucene-solr] 02/04: @570 A bit of XPath polish.

This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit cf68f7ccceac86ad1a4e3d71a19b52b7314658f2
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Wed Aug 19 19:53:15 2020 -0500

    @570 A bit of XPath polish.
---
 .../facet/LegacyAbstractAnalyticsFacetTest.java    |  6 ++--
 .../src/java/org/apache/solr/core/SolrConfig.java  | 18 ++++++------
 .../java/org/apache/solr/core/SolrXmlConfig.java   | 20 ++++++-------
 .../java/org/apache/solr/core/XmlConfigFile.java   | 34 +++++++++++++++-------
 .../handler/component/QueryElevationComponent.java |  2 +-
 .../org/apache/solr/schema/AbstractEnumField.java  |  2 +-
 .../apache/solr/schema/FieldTypePluginLoader.java  | 16 +++++-----
 .../solr/schema/FileExchangeRateProvider.java      |  2 +-
 .../java/org/apache/solr/schema/IndexSchema.java   | 17 ++---------
 .../java/org/apache/solr/search/CacheConfig.java   |  3 +-
 .../org/apache/solr/update/SolrIndexConfig.java    | 11 +++----
 .../java/org/apache/solr/util/SimplePostTool.java  |  2 +-
 .../solr/util/plugin/AbstractPluginLoader.java     |  5 ++--
 .../org/apache/solr/core/TestCodecSupport.java     |  2 +-
 .../src/test/org/apache/solr/core/TestConfig.java  |  2 +-
 .../solr/schema/TestUseDocValuesAsStored.java      |  2 +-
 .../org/apache/solr/common/ParWorkExecutor.java    |  5 ----
 .../java/org/apache/solr/util/BaseTestHarness.java |  3 +-
 .../java/org/apache/solr/util/DOMUtilTestBase.java |  2 +-
 19 files changed, 78 insertions(+), 76 deletions(-)

diff --git a/solr/contrib/analytics/src/test/org/apache/solr/analytics/legacy/facet/LegacyAbstractAnalyticsFacetTest.java b/solr/contrib/analytics/src/test/org/apache/solr/analytics/legacy/facet/LegacyAbstractAnalyticsFacetTest.java
index de2eba3..1d68585 100644
--- a/solr/contrib/analytics/src/test/org/apache/solr/analytics/legacy/facet/LegacyAbstractAnalyticsFacetTest.java
+++ b/solr/contrib/analytics/src/test/org/apache/solr/analytics/legacy/facet/LegacyAbstractAnalyticsFacetTest.java
@@ -89,7 +89,7 @@ public class LegacyAbstractAnalyticsFacetTest extends SolrTestCaseJ4 {
   }
 
   protected Node getNode(String xPath) throws XPathExpressionException {
-    return (Node) IndexSchema.getXpath().compile(xPath).evaluate(doc, XPathConstants.NODE);
+    return (Node) XmlConfigFile.getXpath().compile(xPath).evaluate(doc, XPathConstants.NODE);
   }
   private NodeList getNodes(String n1, String n2, String n3, String element, String n4) throws XPathExpressionException {
     // Construct the XPath expression. The form better not change or all these will fail.
@@ -98,7 +98,7 @@ public class LegacyAbstractAnalyticsFacetTest extends SolrTestCaseJ4 {
     sb.append("/lst[@name='").append(n3).append("']");
     sb.append("/lst[@name!='(MISSING)']");
     sb.append("//").append(element).append("[@name='").append(n4).append("']");
-    return (NodeList) IndexSchema.getXpath().compile(sb.toString()).evaluate(doc, XPathConstants.NODESET);
+    return (NodeList) XmlConfigFile.getXpath().compile(sb.toString()).evaluate(doc, XPathConstants.NODESET);
 
   }
   protected ArrayList<String> getStringList(String n1, String n2, String n3, String element, String n4)
@@ -337,7 +337,7 @@ public class LegacyAbstractAnalyticsFacetTest extends SolrTestCaseJ4 {
 
   protected NodeList getNodes(String xPath) throws XPathExpressionException {
     StringBuilder sb = new StringBuilder(xPath);
-    return (NodeList) IndexSchema.getXpath().compile(sb.toString()).evaluate(doc, XPathConstants.NODESET);
+    return (NodeList) XmlConfigFile.getXpath().compile(sb.toString()).evaluate(doc, XPathConstants.NODESET);
   }
 
 }
diff --git a/solr/core/src/java/org/apache/solr/core/SolrConfig.java b/solr/core/src/java/org/apache/solr/core/SolrConfig.java
index 0bb02b9..713c2ed 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrConfig.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrConfig.java
@@ -132,28 +132,28 @@ public class SolrConfig extends XmlConfigFile implements MapSerializable {
 
     try {
 
-      luceneMatchVersionExp = IndexSchema.getXpath().compile(luceneMatchVersionPath);
+      luceneMatchVersionExp = XmlConfigFile.getXpath().compile(luceneMatchVersionPath);
     } catch (XPathExpressionException e) {
       log.error("", e);
     }
 
     try {
-      indexDefaultsExp = IndexSchema.getXpath().compile(indexDefaultsPath);
+      indexDefaultsExp = XmlConfigFile.getXpath().compile(indexDefaultsPath);
     } catch (XPathExpressionException e) {
       log.error("", e);
     }
     try {
-      mainIndexExp = IndexSchema.getXpath().compile(mainIndexPath);
+      mainIndexExp = XmlConfigFile.getXpath().compile(mainIndexPath);
     } catch (XPathExpressionException e) {
       log.error("", e);
     }
     try {
-      nrtModeExp = IndexSchema.getXpath().compile(nrtModePath);
+      nrtModeExp = XmlConfigFile.getXpath().compile(nrtModePath);
     } catch (XPathExpressionException e) {
       log.error("", e);
     }
     try {
-      unlockOnStartupExp = IndexSchema.getXpath().compile(unlockOnStartupPath);
+      unlockOnStartupExp = XmlConfigFile.getXpath().compile(unlockOnStartupPath);
     } catch (XPathExpressionException e) {
       log.error("", e);
     }
@@ -897,7 +897,7 @@ public class SolrConfig extends XmlConfigFile implements MapSerializable {
     if (val != null) return Integer.parseInt(val.toString());
     try {
       path = super.normalize(path);
-      return super.getInt(IndexSchema.getXpath().compile(path), path, def);
+      return super.getInt(XmlConfigFile.getXpath().compile(path), path, def);
     } catch (XPathExpressionException e) {
       throw new SolrException(ErrorCode.BAD_REQUEST, e);
     }
@@ -908,7 +908,7 @@ public class SolrConfig extends XmlConfigFile implements MapSerializable {
     if (val != null) return Boolean.parseBoolean(val.toString());
     try {
       path = super.normalize(path);
-      return super.getBool(IndexSchema.getXpath().compile(path), path, def);
+      return super.getBool(XmlConfigFile.getXpath().compile(path), path, def);
     } catch (XPathExpressionException e) {
       throw new SolrException(ErrorCode.BAD_REQUEST, e);
     }
@@ -918,7 +918,7 @@ public class SolrConfig extends XmlConfigFile implements MapSerializable {
     Object val = overlay.getXPathProperty(path, true);
     try {
       path = super.normalize(path);
-      return val != null ? val.toString() : super.get(IndexSchema.getXpath().compile(path), path);
+      return val != null ? val.toString() : super.get(XmlConfigFile.getXpath().compile(path), path);
     } catch (XPathExpressionException e) {
       throw new SolrException(ErrorCode.BAD_REQUEST, e);
     }
@@ -928,7 +928,7 @@ public class SolrConfig extends XmlConfigFile implements MapSerializable {
     Object val = overlay.getXPathProperty(path, true);
     try {
       path = super.normalize(path);
-      return val != null ? val.toString() : super.get(IndexSchema.getXpath().compile(path), path, def);
+      return val != null ? val.toString() : super.get(XmlConfigFile.getXpath().compile(path), path, def);
     } catch (XPathExpressionException e) {
       throw new SolrException(ErrorCode.BAD_REQUEST, e);
     }
diff --git a/solr/core/src/java/org/apache/solr/core/SolrXmlConfig.java b/solr/core/src/java/org/apache/solr/core/SolrXmlConfig.java
index 92cccb6..68e8510 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrXmlConfig.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrXmlConfig.java
@@ -95,46 +95,46 @@ public class SolrXmlConfig {
 
   static {
 
-
+    XPath xPath = XmlConfigFile.getXpath();
     try {
 
-      shardHandlerFactoryExp = IndexSchema.getXpath().compile(shardHandlerFactoryPath);
+      shardHandlerFactoryExp = xPath.compile(shardHandlerFactoryPath);
     } catch (XPathExpressionException e) {
       log.error("", e);
     }
 
     try {
-      counterExp = IndexSchema.getXpath().compile(counterExpPath);
+      counterExp = xPath.compile(counterExpPath);
     } catch (XPathExpressionException e) {
       log.error("", e);
     }
     try {
-      meterExp = IndexSchema.getXpath().compile(meterPath);
+      meterExp = xPath.compile(meterPath);
     } catch (XPathExpressionException e) {
       log.error("", e);
     }
     try {
-      timerExp = IndexSchema.getXpath().compile(timerPath);
+      timerExp = xPath.compile(timerPath);
     } catch (XPathExpressionException e) {
       log.error("", e);
     }
     try {
-      histoExp = IndexSchema.getXpath().compile(histoPath);
+      histoExp = xPath.compile(histoPath);
     } catch (XPathExpressionException e) {
       log.error("", e);
     }
     try {
-      historyExp = IndexSchema.getXpath().compile(historyPath);
+      historyExp = xPath.compile(historyPath);
     } catch (XPathExpressionException e) {
       log.error("", e);
     }
     try {
-      transientCoreCacheFactoryExp = IndexSchema.getXpath().compile(transientCoreCacheFactoryPath);
+      transientCoreCacheFactoryExp = xPath.compile(transientCoreCacheFactoryPath);
     } catch (XPathExpressionException e) {
       log.error("", e);
     }
     try {
-      tracerConfigExp = IndexSchema.getXpath().compile(tracerConfigPath);
+      tracerConfigExp = xPath.compile(tracerConfigPath);
     } catch (XPathExpressionException e) {
       log.error("", e);
     }
@@ -308,7 +308,7 @@ public class SolrXmlConfig {
   private static Properties loadProperties(XmlConfigFile config) {
     try {
       Node node = ((NodeList) config.evaluate("solr", XPathConstants.NODESET)).item(0);
-      XPath xpath = config.getXPath();
+      XPath xpath = XmlConfigFile.getXpath();
       NodeList props = (NodeList) xpath.evaluate("property", node, XPathConstants.NODESET);
       Properties properties = new Properties(config.getSubstituteProperties());
       for (int i = 0; i < props.getLength(); i++) {
diff --git a/solr/core/src/java/org/apache/solr/core/XmlConfigFile.java b/solr/core/src/java/org/apache/solr/core/XmlConfigFile.java
index 76f3455..b311291 100644
--- a/solr/core/src/java/org/apache/solr/core/XmlConfigFile.java
+++ b/solr/core/src/java/org/apache/solr/core/XmlConfigFile.java
@@ -49,6 +49,7 @@ import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathExpression;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
+import javax.xml.xpath.XPathFactoryConfigurationException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.lang.invoke.MethodHandles;
@@ -68,11 +69,18 @@ import java.util.TreeSet;
 public class XmlConfigFile { // formerly simply "Config"
   private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
+
   public static final XMLErrorLogger xmllog = new XMLErrorLogger(log);
-  public static final XPathFactory xpathFactory = new XPathFactoryImpl();
+
+  protected final static ThreadLocal<XPath> THREAD_LOCAL_XPATH = new ThreadLocal<>();
+  public static final XPathFactoryImpl xpathFactory = new XPathFactoryImpl();
   public static final SaxonTransformerFactory tfactory = new BasicTransformerFactory();
   static  {
-   // tfactory.getConfiguration().setBooleanProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.TRUE);
+
+      xpathFactory.getConfiguration().setValidation(false);
+      xpathFactory.getConfiguration().setExpandAttributeDefaults(false);
+
+    // tfactory.getConfiguration().setBooleanProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.TRUE);
   }
   public static final Transformer tx = tfactory.newTransformer();
 
@@ -84,6 +92,16 @@ public class XmlConfigFile { // formerly simply "Config"
   private final Properties substituteProperties;
   private int zkVersion = -1;
 
+
+  public static XPath getXpath() {
+    XPath xPath = THREAD_LOCAL_XPATH.get();
+    if (xPath == null) {
+      xPath = XmlConfigFile.xpathFactory.newXPath();
+      THREAD_LOCAL_XPATH.set(xPath);
+    }
+    return xPath;
+  }
+
   /**
    * Builds a config from a resource name with no xpath prefix.  Does no property substitution.
    */
@@ -218,10 +236,6 @@ public class XmlConfigFile { // formerly simply "Config"
       return doc;
     }
 
-    public XPath getXPath () {
-      return IndexSchema.getXpath();
-    }
-
     String normalize(String path){
       return (prefix == null || path.startsWith("/")) ? path : prefix + path;
     }
@@ -231,7 +245,7 @@ public class XmlConfigFile { // formerly simply "Config"
         String xstr = normalize(path);
 
         // TODO: instead of prepending /prefix/, we could do the search rooted at /prefix...
-        Object o = IndexSchema.getXpath().evaluate(xstr, doc, type);
+        Object o = getXpath().evaluate(xstr, doc, type);
         return o;
 
       } catch (XPathExpressionException e) {
@@ -248,7 +262,7 @@ public class XmlConfigFile { // formerly simply "Config"
     public Node getNode (String expression, boolean errifMissing){
       String path = normalize(expression);
       try {
-        return getNode(IndexSchema.getXpath().compile(path), path, doc, errifMissing);
+        return getNode(getXpath().compile(path), path, doc, errifMissing);
       } catch (XPathExpressionException e) {
         throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e);
       }
@@ -298,7 +312,7 @@ public class XmlConfigFile { // formerly simply "Config"
       String xstr = normalize(path);
 
       try {
-        NodeList nodeList = (NodeList) IndexSchema.getXpath()
+        NodeList nodeList = (NodeList) getXpath()
             .evaluate(xstr, doc, XPathConstants.NODESET);
 
         if (null == nodeList) {
@@ -397,7 +411,7 @@ public class XmlConfigFile { // formerly simply "Config"
     public String getVal (String expression, boolean errIfMissing){
       String xstr = normalize(expression);
       try {
-        return getVal(IndexSchema.getXpath().compile(xstr), expression, errIfMissing);
+        return getVal(getXpath().compile(xstr), expression, errIfMissing);
       } catch (XPathExpressionException e) {
         throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e);
       }
diff --git a/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java b/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java
index 3e62b15..4c2c077 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
@@ -394,7 +394,7 @@ public class QueryElevationComponent extends SearchComponent implements SolrCore
    */
   protected ElevationProvider loadElevationProvider(XmlConfigFile config) {
     Map<ElevatingQuery, ElevationBuilder> elevationBuilderMap = new LinkedHashMap<>();
-    XPath xpath = IndexSchema.getXpath();
+    XPath xpath = XmlConfigFile.getXpath();
     NodeList nodes = (NodeList) config.evaluate("elevate/query", XPathConstants.NODESET);
     for (int i = 0; i < nodes.getLength(); i++) {
       Node node = nodes.item(i);
diff --git a/solr/core/src/java/org/apache/solr/schema/AbstractEnumField.java b/solr/core/src/java/org/apache/solr/schema/AbstractEnumField.java
index fbbe168..493ccad 100644
--- a/solr/core/src/java/org/apache/solr/schema/AbstractEnumField.java
+++ b/solr/core/src/java/org/apache/solr/schema/AbstractEnumField.java
@@ -112,7 +112,7 @@ public abstract class AbstractEnumField extends PrimitiveFieldType {
       try {
         log.debug("Reloading enums config file from {}", enumsConfigFile);
         Document doc = SafeXMLParsing.parseConfigXML(log, loader, enumsConfigFile);
-        final XPath xpath = IndexSchema.getXpath();
+        final XPath xpath = XmlConfigFile.getXpath();
         final String xpathStr = String.format(Locale.ROOT, "/enumsConfig/enum[@name='%s']", enumName);
         final NodeList nodes = (NodeList) xpath.evaluate(xpathStr, doc, XPathConstants.NODESET);
         final int nodesLength = nodes.getLength();
diff --git a/solr/core/src/java/org/apache/solr/schema/FieldTypePluginLoader.java b/solr/core/src/java/org/apache/solr/schema/FieldTypePluginLoader.java
index 04efa40..1a719b0 100644
--- a/solr/core/src/java/org/apache/solr/schema/FieldTypePluginLoader.java
+++ b/solr/core/src/java/org/apache/solr/schema/FieldTypePluginLoader.java
@@ -27,6 +27,8 @@ import org.apache.solr.common.SolrException;
 import org.apache.solr.common.util.Utils;
 import org.apache.solr.core.SolrConfig;
 import org.apache.solr.core.SolrResourceLoader;
+import org.apache.solr.core.SolrXmlConfig;
+import org.apache.solr.core.XmlConfigFile;
 import org.apache.solr.util.DOMUtil;
 import org.apache.solr.util.plugin.AbstractPluginLoader;
 import org.slf4j.Logger;
@@ -65,40 +67,40 @@ public final class FieldTypePluginLoader
 
   static {
     try {
-      analyzerQueryExp = IndexSchema.getXpath().compile("./analyzer[@type='query']");
+      analyzerQueryExp = XmlConfigFile.getXpath().compile("./analyzer[@type='query']");
     } catch (XPathExpressionException e) {
       log.error("", e);
     }
     try {
-      analyzerMultiTermExp = IndexSchema.getXpath().compile("./analyzer[@type='multiterm']");
+      analyzerMultiTermExp = XmlConfigFile.getXpath().compile("./analyzer[@type='multiterm']");
     } catch (XPathExpressionException e) {
       log.error("", e);
     }
 
     try {
-      analyzerIndexExp = IndexSchema.getXpath().compile("./analyzer[not(@type)] | ./analyzer[@type='index']");
+      analyzerIndexExp = XmlConfigFile.getXpath().compile("./analyzer[not(@type)] | ./analyzer[@type='index']");
     } catch (XPathExpressionException e) {
       log.error("", e);
     }
     try {
-      similarityExp = IndexSchema.getXpath().compile("./similarity");
+      similarityExp = XmlConfigFile.getXpath().compile("./similarity");
     } catch (XPathExpressionException e) {
       log.error("", e);
     }
 
 
     try {
-      charFilterExp = IndexSchema.getXpath().compile("./charFilter");
+      charFilterExp = XmlConfigFile.getXpath().compile("./charFilter");
     } catch (XPathExpressionException e) {
       log.error("", e);
     }
     try {
-      tokenizerExp = IndexSchema.getXpath().compile("./tokenizer");
+      tokenizerExp = XmlConfigFile.getXpath().compile("./tokenizer");
     } catch (XPathExpressionException e) {
       log.error("", e);
     }
     try {
-      filterExp = IndexSchema.getXpath().compile("./filter");
+      filterExp = XmlConfigFile.getXpath().compile("./filter");
     } catch (XPathExpressionException e) {
       log.error("", e);
     }
diff --git a/solr/core/src/java/org/apache/solr/schema/FileExchangeRateProvider.java b/solr/core/src/java/org/apache/solr/schema/FileExchangeRateProvider.java
index 49e1510..0be9204 100644
--- a/solr/core/src/java/org/apache/solr/schema/FileExchangeRateProvider.java
+++ b/solr/core/src/java/org/apache/solr/schema/FileExchangeRateProvider.java
@@ -165,7 +165,7 @@ public class FileExchangeRateProvider implements ExchangeRateProvider {
 
     try {
       Document doc = SafeXMLParsing.parseConfigXML(log, loader, currencyConfigFile);
-      XPath xpath = ManagedIndexSchema.getXpath();
+      XPath xpath = XmlConfigFile.getXpath();
       
       // Parse exchange rates.
       NodeList nodes = (NodeList) xpath.evaluate("/currencyConfig/rates/rate", doc, XPathConstants.NODESET);
diff --git a/solr/core/src/java/org/apache/solr/schema/IndexSchema.java b/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
index f964959..935b2c8 100644
--- a/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
+++ b/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
@@ -133,9 +133,6 @@ public class IndexSchema {
   private static final String TEXT_FUNCTION = "text()";
   private static final String XPATH_OR = " | ";
 
-
-  static XPath xpath = XmlConfigFile.xpathFactory.newXPath();
-
   private static XPathExpression xpathOrExp;
   private static XPathExpression schemaNameExp;
   private static XPathExpression schemaVersionExp;
@@ -160,6 +157,7 @@ public class IndexSchema {
   static String schemaUniqueKeyPath = stepsToPath(SCHEMA, UNIQUE_KEY, TEXT_FUNCTION);
 
   static {
+    XPath xpath = XmlConfigFile.getXpath();
     try {
       String expression = stepsToPath(SCHEMA, FIELD)
           + XPATH_OR + stepsToPath(SCHEMA, DYNAMIC_FIELD)
@@ -246,8 +244,6 @@ public class IndexSchema {
    */
   protected Map<SchemaField, Integer> copyFieldTargetCounts = new HashMap<>();
 
-  protected final static ThreadLocal<XPath> THREAD_LOCAL_XPATH = new ThreadLocal<>();
-
   /**
    * Constructs a schema using the specified resource name and stream.
    * By default, this follows the normal config path directory searching rules.
@@ -271,15 +267,6 @@ public class IndexSchema {
     this.substitutableProperties = substitutableProperties;
   }
 
-  public static XPath getXpath() {
-    XPath xPath = THREAD_LOCAL_XPATH.get();
-    if (xPath == null) {
-      xPath = XmlConfigFile.xpathFactory.newXPath();
-      THREAD_LOCAL_XPATH.set(xPath);
-    }
-    return xPath;
-  }
-
   /**
    * The resource loader to be used to load components related to the schema when the schema is loading
    * / initialising.
@@ -567,7 +554,7 @@ public class IndexSchema {
       // in the current case though, the stream is valid so we wont load the resource by name
       XmlConfigFile schemaConf = new XmlConfigFile(loader, SCHEMA, is, SLASH+SCHEMA+SLASH, substitutableProperties);
       Document document = schemaConf.getDocument();
-      final XPath xpath = schemaConf.getXPath();
+      final XPath xpath = XmlConfigFile.getXpath();
 
       Node nd = (Node) schemaNameExp.evaluate(document, XPathConstants.NODE);
       StringBuilder sb = new StringBuilder();
diff --git a/solr/core/src/java/org/apache/solr/search/CacheConfig.java b/solr/core/src/java/org/apache/solr/search/CacheConfig.java
index b206825..7910e8e 100644
--- a/solr/core/src/java/org/apache/solr/search/CacheConfig.java
+++ b/solr/core/src/java/org/apache/solr/search/CacheConfig.java
@@ -31,6 +31,7 @@ import org.apache.solr.common.MapSerializable;
 import org.apache.solr.common.util.Utils;
 import org.apache.solr.core.SolrConfig;
 import org.apache.solr.core.SolrResourceLoader;
+import org.apache.solr.core.XmlConfigFile;
 import org.apache.solr.schema.IndexSchema;
 import org.apache.solr.util.DOMUtil;
 import org.slf4j.Logger;
@@ -102,7 +103,7 @@ public class CacheConfig implements MapSerializable{
     Node node = null;
     try {
       String path = IndexSchema.normalize(xpath, "/config/");
-      node = solrConfig.getNode(IndexSchema.getXpath().compile(path), path, false);
+      node = solrConfig.getNode(XmlConfigFile.getXpath().compile(path), path, false);
     } catch (XPathExpressionException e) {
       throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e);
     }
diff --git a/solr/core/src/java/org/apache/solr/update/SolrIndexConfig.java b/solr/core/src/java/org/apache/solr/update/SolrIndexConfig.java
index ee316d1..dfd6033 100644
--- a/solr/core/src/java/org/apache/solr/update/SolrIndexConfig.java
+++ b/solr/core/src/java/org/apache/solr/update/SolrIndexConfig.java
@@ -39,6 +39,7 @@ import org.apache.solr.core.PluginInfo;
 import org.apache.solr.core.SolrConfig;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.core.SolrResourceLoader;
+import org.apache.solr.core.XmlConfigFile;
 import org.apache.solr.index.DefaultMergePolicyFactory;
 import org.apache.solr.index.MergePolicyFactory;
 import org.apache.solr.index.MergePolicyFactoryArgs;
@@ -84,28 +85,28 @@ public class SolrIndexConfig implements MapSerializable {
 
     try {
 
-      indexConfigExp = IndexSchema.getXpath().compile(indexConfigPath);
+      indexConfigExp = XmlConfigFile.getXpath().compile(indexConfigPath);
     } catch (XPathExpressionException e) {
       log.error("", e);
     }
 
     try {
-      mergeSchedulerExp = IndexSchema.getXpath().compile(mergeSchedulerPath);
+      mergeSchedulerExp = XmlConfigFile.getXpath().compile(mergeSchedulerPath);
     } catch (XPathExpressionException e) {
       log.error("", e);
     }
     try {
-      mergePolicyExp = IndexSchema.getXpath().compile(mergePolicyPath);
+      mergePolicyExp = XmlConfigFile.getXpath().compile(mergePolicyPath);
     } catch (XPathExpressionException e) {
       log.error("", e);
     }
     try {
-      ramBufferSizeMBExp = IndexSchema.getXpath().compile(ramBufferSizeMBPath);
+      ramBufferSizeMBExp = XmlConfigFile.getXpath().compile(ramBufferSizeMBPath);
     } catch (XPathExpressionException e) {
       log.error("", e);
     }
     try {
-      checkIntegrityAtMergeExp = IndexSchema.getXpath().compile(checkIntegrityAtMergePath);
+      checkIntegrityAtMergeExp = XmlConfigFile.getXpath().compile(checkIntegrityAtMergePath);
     } catch (XPathExpressionException e) {
       log.error("", e);
     }
diff --git a/solr/core/src/java/org/apache/solr/util/SimplePostTool.java b/solr/core/src/java/org/apache/solr/util/SimplePostTool.java
index 025e478..5998b7c 100644
--- a/solr/core/src/java/org/apache/solr/util/SimplePostTool.java
+++ b/solr/core/src/java/org/apache/solr/util/SimplePostTool.java
@@ -1058,7 +1058,7 @@ public class SimplePostTool {
    * Gets all nodes matching an XPath
    */
   public static NodeList getNodesFromXP(Node n, String xpath) throws XPathExpressionException {
-    XPath xp = IndexSchema.getXpath();
+    XPath xp = XmlConfigFile.getXpath();
     XPathExpression expr = xp.compile(xpath);
     return (NodeList) expr.evaluate(n, XPathConstants.NODESET);
   }
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.java
index e55fee9..5686ab6 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
@@ -25,6 +25,7 @@ import org.apache.solr.common.ParWork;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrException.ErrorCode;
 import org.apache.solr.core.SolrResourceLoader;
+import org.apache.solr.core.XmlConfigFile;
 import org.apache.solr.schema.IndexSchema;
 import org.apache.solr.util.DOMUtil;
 import org.slf4j.Logger;
@@ -142,7 +143,7 @@ public abstract class AbstractPluginLoader<T>
   {
     List<PluginInitInfo> info = new ArrayList<>();
     T defaultPlugin = null;
-    XPath xpath = IndexSchema.getXpath();
+    XPath xpath = XmlConfigFile.getXpath();
     if (nodes !=null ) {
       for (int i=0; i<nodes.getLength(); i++) {
         Node node = nodes.item(i);
@@ -236,7 +237,7 @@ public abstract class AbstractPluginLoader<T>
     try {
       String name = DOMUtil.getAttr(node, NAME, requireName ? type : null);
       String className = DOMUtil.getAttr(node, "class", type);
-      plugin = create(loader, name, className, node, IndexSchema.getXpath());
+      plugin = create(loader, name, className, node, XmlConfigFile.getXpath());
       if (log.isDebugEnabled()) {
         log.debug("created {}: {}", name, plugin.getClass().getName());
       }
diff --git a/solr/core/src/test/org/apache/solr/core/TestCodecSupport.java b/solr/core/src/test/org/apache/solr/core/TestCodecSupport.java
index e61c170..7a379ef 100644
--- a/solr/core/src/test/org/apache/solr/core/TestCodecSupport.java
+++ b/solr/core/src/test/org/apache/solr/core/TestCodecSupport.java
@@ -208,7 +208,7 @@ public class TestCodecSupport extends SolrTestCaseJ4 {
     assertEquals("Unexpected codec factory for this test.", "solr.SchemaCodecFactory", config.get("codecFactory/@class"));
     String path = IndexSchema.normalize("codecFactory", config.getPrefix());
     assertNull("Unexpected configuration of codec factory for this test. Expecting empty element", 
-        config.getNode(IndexSchema.getXpath().compile(path), path, false).getFirstChild());
+        config.getNode(XmlConfigFile.getXpath().compile(path), path, false).getFirstChild());
     IndexSchema schema = IndexSchemaFactory.buildIndexSchema("schema_codec.xml", config);
 
     CoreContainer coreContainer = h.getCoreContainer();
diff --git a/solr/core/src/test/org/apache/solr/core/TestConfig.java b/solr/core/src/test/org/apache/solr/core/TestConfig.java
index 118e1f5..4f7b818 100644
--- a/solr/core/src/test/org/apache/solr/core/TestConfig.java
+++ b/solr/core/src/test/org/apache/solr/core/TestConfig.java
@@ -98,7 +98,7 @@ public class TestConfig extends SolrTestCaseJ4 {
     assertEquals(1, nl.getLength());
     assertEquals("prefix-proptwo-suffix", nl.item(0).getTextContent());
     String path = IndexSchema.normalize("propTest", solrConfig.getPrefix());
-    Node node = solrConfig.getNode(IndexSchema.getXpath().compile(path), path, true);
+    Node node = solrConfig.getNode(XmlConfigFile.getXpath().compile(path), path, true);
     assertEquals("prefix-proptwo-suffix", node.getTextContent());
   }
 
diff --git a/solr/core/src/test/org/apache/solr/schema/TestUseDocValuesAsStored.java b/solr/core/src/test/org/apache/solr/schema/TestUseDocValuesAsStored.java
index 569d6bb..c453755 100644
--- a/solr/core/src/test/org/apache/solr/schema/TestUseDocValuesAsStored.java
+++ b/solr/core/src/test/org/apache/solr/schema/TestUseDocValuesAsStored.java
@@ -77,7 +77,7 @@ public class TestUseDocValuesAsStored extends AbstractBadConfigTestBase {
       DocumentBuilder builder = FieldTypeXmlAdapter.getDocumentBuilder();
       InputStream stream = TestUseDocValuesAsStored.class.getResourceAsStream("/solr/collection1/conf/enumsConfig.xml");
       Document doc = builder.parse(new InputSource(IOUtils.getDecodingReader(stream, StandardCharsets.UTF_8)));
-      XPath xpath = ManagedIndexSchema.getXpath();
+      XPath xpath = XmlConfigFile.getXpath();
       NodeList nodes = (NodeList)xpath.evaluate
           ("/enumsConfig/enum[@name='severity']/value", doc, XPathConstants.NODESET);
       SEVERITY = new String[nodes.getLength()];
diff --git a/solr/solrj/src/java/org/apache/solr/common/ParWorkExecutor.java b/solr/solrj/src/java/org/apache/solr/common/ParWorkExecutor.java
index e8bbd62..dc64869 100644
--- a/solr/solrj/src/java/org/apache/solr/common/ParWorkExecutor.java
+++ b/solr/solrj/src/java/org/apache/solr/common/ParWorkExecutor.java
@@ -1,20 +1,15 @@
 package org.apache.solr.common;
 
-import org.apache.solr.common.util.ExecutorUtil;
-import org.apache.solr.common.util.SolrNamedThreadFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.lang.invoke.MethodHandles;
 import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.RejectedExecutionException;
 import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.locks.ReentrantLock;
 
 public class ParWorkExecutor extends ThreadPoolExecutor {
   private static final Logger log = LoggerFactory
diff --git a/solr/test-framework/src/java/org/apache/solr/util/BaseTestHarness.java b/solr/test-framework/src/java/org/apache/solr/util/BaseTestHarness.java
index 01330e8..1ffb0c5 100644
--- a/solr/test-framework/src/java/org/apache/solr/util/BaseTestHarness.java
+++ b/solr/test-framework/src/java/org/apache/solr/util/BaseTestHarness.java
@@ -18,6 +18,7 @@ package org.apache.solr.util;
 
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.util.XML;
+import org.apache.solr.core.XmlConfigFile;
 import org.apache.solr.rest.schema.FieldTypeXmlAdapter;
 import org.apache.solr.schema.IndexSchema;
 import org.w3c.dom.Document;
@@ -55,7 +56,7 @@ abstract public class BaseTestHarness {
   }
 
   public static XPath getXpath() {
-    return IndexSchema.getXpath();
+    return XmlConfigFile.getXpath();
   }
 
 
diff --git a/solr/test-framework/src/java/org/apache/solr/util/DOMUtilTestBase.java b/solr/test-framework/src/java/org/apache/solr/util/DOMUtilTestBase.java
index c32233d..af78575 100644
--- a/solr/test-framework/src/java/org/apache/solr/util/DOMUtilTestBase.java
+++ b/solr/test-framework/src/java/org/apache/solr/util/DOMUtilTestBase.java
@@ -46,7 +46,7 @@ public abstract class DOMUtilTestBase extends SolrTestCase {
   }
   
   public Node getNode( Document doc, String path ) throws Exception {
-    XPath xpath = IndexSchema.getXpath();
+    XPath xpath = XmlConfigFile.getXpath();
     return (Node)xpath.evaluate(path, doc, XPathConstants.NODE);
   }