diff options
author | Arne H Juul <arnej@yahooinc.com> | 2022-03-23 14:26:25 +0000 |
---|---|---|
committer | Arne H Juul <arnej@yahooinc.com> | 2022-03-23 14:26:25 +0000 |
commit | 7f681ccfdca9cb837b26b8fb86dcfccba1fecb0a (patch) | |
tree | a618f28c226f5368c39eaaad66afca5bcd8a92e6 /config-model | |
parent | 66e514807987da03b76720161d44dbb0c28f02b6 (diff) |
add consistency checks
Diffstat (limited to 'config-model')
-rw-r--r-- | config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java b/config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java index 9654029ea13..5b7b23d69d4 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java @@ -254,6 +254,17 @@ public class DocumentModelBuilder { if (other == null || other == type) { throw new IllegalArgumentException("No replacement found for temporary type: " + type); } + if (other instanceof OwnedStructDataType) { + var owned = (OwnedTemporaryType) type; + String ownedBy = owned.getOwnerName(); + var otherOwned = (OwnedStructDataType) other; + String otherOwnedBy = otherOwned.getOwnerName(); + if (! ownedBy.equals(otherOwnedBy)) { + throw new IllegalArgumentException("Wrong document for type: " + otherOwnedBy + " but expected " + ownedBy); + } + } else { + throw new IllegalArgumentException("Found wrong sort of type: " + other + " [" + other.getClass() + "]"); + } type = other; } else if (type instanceof DocumentType) { DataType other = getDocumentType(docs, type.getName()); |