summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-08-12 15:59:55 +0200
committerGitHub <noreply@github.com>2021-08-12 15:59:55 +0200
commit906f75648e6f0a596c791d71812a6636884adf13 (patch)
tree5ac610c49715cc7537d8c9d37f228f22cf98c8c3
parentbd31e38d4563bcbb32effd5d3db28caf858b4c84 (diff)
parent1f02b21b480f49177cbcc7d24cd1cce871515751 (diff)
Merge pull request #18729 from vespa-engine/balder/improve-distributable-resource-validation
Improve sanity check for blobs.
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/DistributableResource.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/DistributableResource.java b/config-model/src/main/java/com/yahoo/searchdefinition/DistributableResource.java
index ffa9cbe9ba5..4793caad308 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/DistributableResource.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/DistributableResource.java
@@ -76,8 +76,16 @@ public class DistributableResource {
public String getFileReference() { return fileReference; }
public void validate() {
- if (path == null || path.isEmpty())
- throw new IllegalArgumentException("Distributable resource must have a file or uri.");
+ switch (pathType) {
+ case FILE:
+ case URI:
+ if (path == null || path.isEmpty())
+ throw new IllegalArgumentException("Distributable URI/FILE resource must have a file or uri.");
+ break;
+ case BLOB:
+ if (blob == null)
+ throw new IllegalArgumentException("Distributable BLOB can not be null.");
+ }
}
public String toString() {