Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-15337: Avoid XPath in solrconfig.xml parsing (take 2) (#386)

Noble Paulaa8e3c602de7
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 edd9b68ccd2..f986906fd45 100644
--- a/solr/core/src/java/org/apache/solr/update/SolrIndexConfig.java
+++ b/solr/core/src/java/org/apache/solr/update/SolrIndexConfig.java
@@ -162,7 +162,7 @@ public class SolrIndexConfig implements MapSerializable {
get("maxMergeDocs").isNull(),
true);
assertWarnOrFail("Beginning with Solr 7.0, <mergeFactor> is no longer supported, configure it on the relevant <mergePolicyFactory> instead.",
- get("maxMergeFactor").isNull(),
+ get("mergeFactor").isNull(),
true);
if (get("termIndexInterval").exists()) {
diff --git a/solr/core/src/java/org/apache/solr/util/DataConfigNode.java b/solr/core/src/java/org/apache/solr/util/DataConfigNode.java
index 78676a2951d..3a4d5d41ff5 100644
--- a/solr/core/src/java/org/apache/solr/util/DataConfigNode.java
+++ b/solr/core/src/java/org/apache/solr/util/DataConfigNode.java
@@ -27,8 +27,6 @@ import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.function.Predicate;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
import org.apache.solr.cluster.api.SimpleMap;
import org.apache.solr.common.ConfigNode;
import org.apache.solr.common.util.PropertiesUtil;
@@ -57,10 +55,10 @@ public class DataConfigNode implements ConfigNode {
});
for (Map.Entry<String, List<ConfigNode>> e : kids.entrySet()) {
if(e.getValue() != null) {
- e.setValue(ImmutableList.copyOf(e.getValue()));
+ e.setValue(List.copyOf(e.getValue()));
}
}
- this.kids = kids.isEmpty()? EMPTY: new WrappedSimpleMap<>(ImmutableMap.copyOf(kids));
+ this.kids = kids.isEmpty()? EMPTY: new WrappedSimpleMap<>(Map.copyOf(kids));
}
public String subtituteVal(String s) {
diff --git a/solr/solrj/src/java/org/apache/solr/common/ConfigNode.java b/solr/solrj/src/java/org/apache/solr/common/ConfigNode.java
index 09aa0a72aa5..cf58a1867c1 100644
--- a/solr/solrj/src/java/org/apache/solr/common/ConfigNode.java
+++ b/solr/solrj/src/java/org/apache/solr/common/ConfigNode.java
@@ -140,7 +140,8 @@ public interface ConfigNode {
default boolean exists() { return true; }
default boolean isNull() { return false; }
- /** abortable iterate through children
+ /**
+ * abortable iterate through children
*
* @param fun consume the node and return true to continue or false to abort
*/
@@ -178,6 +179,7 @@ public interface ConfigNode {
return EMPTY;
}
+ @Override
public boolean exists() { return false; }
@Override
@@ -194,11 +196,12 @@ public interface ConfigNode {
static int _int(Object v, int def) { return v==null? def: Integer.parseInt(v.toString()); }
static double _double(Object v, double def) { return v == null ? def: Double.parseDouble(v.toString()); }
public static Predicate<ConfigNode> at(int i) {
- return new Predicate<ConfigNode>() {
- int index =0;
+ return new Predicate<>() {
+ int index = 0;
+
@Override
public boolean test(ConfigNode node) {
- if(index == i) return true;
+ if (index == i) return true;
index++;
return false;
}