diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-08-12 13:07:18 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-08-12 13:56:08 +0000 |
commit | 1f02b21b480f49177cbcc7d24cd1cce871515751 (patch) | |
tree | 5ac610c49715cc7537d8c9d37f228f22cf98c8c3 | |
parent | bd31e38d4563bcbb32effd5d3db28caf858b4c84 (diff) |
Improve sanity check for blobs.
-rw-r--r-- | config-model/src/main/java/com/yahoo/searchdefinition/DistributableResource.java | 12 |
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() { |