summaryrefslogtreecommitdiffstats
path: root/document/src/main
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@oath.com>2017-12-06 12:27:27 +0100
committerTor Brede Vekterli <vekterli@oath.com>2017-12-06 12:27:27 +0100
commit94d97265da8486c939d0f0c0ea1b80b5e63b0b07 (patch)
treed6509e70324fbed7ef953cac494483d9dfe9414e /document/src/main
parent351229b42387bbef47163e423f0c1c570f1dbeb1 (diff)
Disallow ID strings with empty user/group values
It does not make sense to have an empty value for these, as the value plays an explicit part of the document's distribution properties.
Diffstat (limited to 'document/src/main')
-rw-r--r--document/src/main/java/com/yahoo/document/idstring/IdIdString.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/document/src/main/java/com/yahoo/document/idstring/IdIdString.java b/document/src/main/java/com/yahoo/document/idstring/IdIdString.java
index 7fcb530b347..44ff08c73f0 100644
--- a/document/src/main/java/com/yahoo/document/idstring/IdIdString.java
+++ b/document/src/main/java/com/yahoo/document/idstring/IdIdString.java
@@ -62,6 +62,9 @@ public class IdIdString extends IdString {
if (hasSetLocation) {
throw new IllegalArgumentException("Illegal key combination in " + keyValues);
}
+ if (value.isEmpty()) {
+ throw new IllegalArgumentException("ID location value for 'n=' key is empty");
+ }
location = Long.parseLong(value);
hasSetLocation = true;
hasNumber = true;
@@ -70,6 +73,9 @@ public class IdIdString extends IdString {
if (hasSetLocation) {
throw new IllegalArgumentException("Illegal key combination in " + keyValues);
}
+ if (value.isEmpty()) {
+ throw new IllegalArgumentException("ID location value for 'g=' key is empty");
+ }
location = makeLocation(value);
hasSetLocation = true;
hasGroup = true;