in ch-sxmp/src/main/java/com/cloudhopper/sxmp/OptionalParamMap.java [206:228]
private void validateEntry(String key, Object value) {
if (isBlank(key)) {
throw new IllegalArgumentException("key cannot be null/blank");
}
if (ModifiedUTF8Charset.calculateByteLength(key) > 255) {
throw new IllegalArgumentException("key length > 255 bytes");
}
else if (value == null) {
throw new IllegalArgumentException("value cannot be null");
}
else if (value instanceof String) {
if (ModifiedUTF8Charset.calculateByteLength((String) value) > 32767) {
throw new IllegalArgumentException("string value length > 34767 bytes");
}
}
else if (value instanceof Integer ||
value instanceof Long ||
value instanceof Double) {
// valid
} else {
throw new IllegalArgumentException("Illegal value type: "+value.getClass().toString());
}
}