aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-09-14 18:14:22 +0200
committerJon Bratseth <bratseth@gmail.com>2022-09-14 18:14:22 +0200
commite12489f2b51a36828f49735173bad2c99492feb4 (patch)
treeaf62f38a4cf51a4a4d17bfb2ae04b4e299be28f0 /config-model/src
parent58ce86bd1a8006c49f8286bfb73ba0f56276f2fb (diff)
Don't rely on the config definition being available
Diffstat (limited to 'config-model/src')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomConfigPayloadBuilder.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomConfigPayloadBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomConfigPayloadBuilder.java
index 9390986c0c4..f37453b363a 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomConfigPayloadBuilder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomConfigPayloadBuilder.java
@@ -11,10 +11,8 @@ import com.yahoo.vespa.config.util.ConfigUtils;
import com.yahoo.yolean.Exceptions;
import org.w3c.dom.Element;
import java.util.List;
-import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
/**
* Builder that transforms xml config to a slime tree representation of the config. The root element of the xml config
* must be named 'config' and have a 'name' attribute that matches the name of the {@link ConfigDefinition}. The values
@@ -37,8 +35,8 @@ public class DomConfigPayloadBuilder {
/**
* Builds a {@link ConfigPayloadBuilder} representing the input 'config' xml element.
*
- * @param configE The 'config' xml element
- * @return a new payload builder built from xml.
+ * @param configE the 'config' xml element
+ * @return a new payload builder built from xml
*/
public ConfigPayloadBuilder build(Element configE) {
parseConfigName(configE);
@@ -120,7 +118,6 @@ public class DomConfigPayloadBuilder {
private void parseLeaf(Element element, ConfigPayloadBuilder payloadBuilder, String parentName) {
String name = extractName(element);
String value = XML.getValue(element);
- var definition = payloadBuilder.getConfigDefinition();
if (value == null) {
throw new ConfigurationRuntimeException("Element '" + name + "' must have either children or a value");
}
@@ -134,7 +131,8 @@ public class DomConfigPayloadBuilder {
payloadBuilder.getArray(parentName).append(value);
}
}
- else if (definition != null && definition.getModelDefs().containsKey(name)) { // model field special syntax
+ else if (element.hasAttribute("model-id") || element.hasAttribute("url") || element.hasAttribute("path")) {
+ // special syntax for "model" fields
String modelString = XML.attribute("model-id", element).orElse("\"\"");
modelString += " " + XML.attribute("url", element).orElse("\"\"");
modelString += " " + XML.attribute("path", element).orElse("\"\"");