summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorHarald Musum <musum@yahooinc.com>2023-06-10 11:43:59 +0200
committerHarald Musum <musum@yahooinc.com>2023-06-10 11:43:59 +0200
commitdcfc689ea28052b7378805f805e3922b91d9e376 (patch)
treeb88367a489c7383046b7e1c28b5568e8d0fcaec1 /config-model
parente9ccfa72400a8d6d83f64cb1045b6c64cdb88760 (diff)
Revert "Make error message deterministic by sorting rule names"
This reverts commit 7f13594d6595b81a291018f902c438d3aaea057b.
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/search/SemanticRuleBuilder.java10
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/container/search/SemanticRulesTest.java2
2 files changed, 4 insertions, 8 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/search/SemanticRuleBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/container/search/SemanticRuleBuilder.java
index 4a295d49a32..b184861c102 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/search/SemanticRuleBuilder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/search/SemanticRuleBuilder.java
@@ -12,9 +12,7 @@ import com.yahoo.prelude.semantics.parser.ParseException;
import java.io.File;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
/**
@@ -62,11 +60,9 @@ public class SemanticRuleBuilder {
private void ensureZeroOrOneDefaultRule(SemanticRulesConfig config) {
String defaultName = null;
for (SemanticRulesConfig.Rulebase ruleBase : config.rulebase()) {
- if (defaultName != null && ruleBase.isdefault()) {
- List<String> defaultRules = new ArrayList<>(List.of(defaultName, ruleBase.name()));
- defaultRules.sort(String::compareTo);
- throw new IllegalArgumentException("Rules " + defaultRules + " are both marked as the default rule, there can only be one");
- }
+ if (defaultName != null && ruleBase.isdefault())
+ throw new IllegalArgumentException("Both '" + defaultName + "' and '" + ruleBase.name() +
+ "' is marked as default rule, there can only be one");
if (ruleBase.isdefault())
defaultName = ruleBase.name();
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/search/SemanticRulesTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/search/SemanticRulesTest.java
index e20e14f9465..f0e28f9df09 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/container/search/SemanticRulesTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/container/search/SemanticRulesTest.java
@@ -60,7 +60,7 @@ public class SemanticRulesTest {
new SemanticRuleBuilder().build(FilesApplicationPackage.fromFile(new File(rootWithDuplicateDefault)));
fail("should fail with exception");
} catch (Exception e) {
- assertEquals("Rules [one, other] are both marked as the default rule, there can only be one", e.getMessage());
+ assertEquals("Both 'one' and 'other' is marked as default rule, there can only be one", e.getMessage());
}
}