summaryrefslogtreecommitdiffstats
path: root/document/src/main/java/com/yahoo/document/idstring/IdString.java
diff options
context:
space:
mode:
Diffstat (limited to 'document/src/main/java/com/yahoo/document/idstring/IdString.java')
-rw-r--r--document/src/main/java/com/yahoo/document/idstring/IdString.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/document/src/main/java/com/yahoo/document/idstring/IdString.java b/document/src/main/java/com/yahoo/document/idstring/IdString.java
index 0fe382be914..d25c39f3b44 100644
--- a/document/src/main/java/com/yahoo/document/idstring/IdString.java
+++ b/document/src/main/java/com/yahoo/document/idstring/IdString.java
@@ -42,6 +42,7 @@ public abstract class IdString {
private final String namespace;
private final String namespaceSpecific;
private Utf8String cache;
+ static final int MAX_LENGTH_EXCEPT_NAMESPACE_SPECIFIC = 0xfffe;
/**
* Creates a IdString based on the given document id string.
@@ -115,6 +116,8 @@ public abstract class IdString {
colonPos = id.indexOf(":", currPos);
if (colonPos < 0) {
throw new IllegalArgumentException("Unparseable id '" + id + "': Key/value section missing");
+ } else if (colonPos >= MAX_LENGTH_EXCEPT_NAMESPACE_SPECIFIC) {
+ throw new IllegalArgumentException("Document id prior to the namespace specific part, " + colonPos + ", is longer than " + MAX_LENGTH_EXCEPT_NAMESPACE_SPECIFIC + " id: " + id);
}
String keyValues = id.substring(currPos, colonPos);