mirror of
https://github.com/sismics/docs.git
synced 2024-11-25 15:17:57 +01:00
Merge branch 'master' into sismics_prod
This commit is contained in:
commit
3b1f11e5a8
@ -1,15 +1,14 @@
|
|||||||
package com.sismics.rest.util;
|
package com.sismics.rest.util;
|
||||||
|
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
import com.sismics.rest.exception.ClientException;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.joda.time.DateTime;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.joda.time.DateTime;
|
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
|
||||||
import com.sismics.rest.exception.ClientException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility class to validate parameters.
|
* Utility class to validate parameters.
|
||||||
*
|
*
|
||||||
@ -58,7 +57,7 @@ public class ValidationUtil {
|
|||||||
throw new ClientException("ValidationError", MessageFormat.format("{0} must be more than {1} characters", name, lengthMin));
|
throw new ClientException("ValidationError", MessageFormat.format("{0} must be more than {1} characters", name, lengthMin));
|
||||||
}
|
}
|
||||||
if (lengthMax != null && s.length() > lengthMax) {
|
if (lengthMax != null && s.length() > lengthMax) {
|
||||||
throw new ClientException("ValidationError", MessageFormat.format("{0} must be more than {1} characters", name, lengthMax));
|
throw new ClientException("ValidationError", MessageFormat.format("{0} must be less than {1} characters", name, lengthMax));
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
@ -574,7 +574,7 @@ public class DocumentResource extends BaseResource {
|
|||||||
|
|
||||||
// Validate input data
|
// Validate input data
|
||||||
title = ValidationUtil.validateLength(title, "title", 1, 100, false);
|
title = ValidationUtil.validateLength(title, "title", 1, 100, false);
|
||||||
language = ValidationUtil.validateLength(language, "language", 3, 3, false);
|
language = ValidationUtil.validateLength(language, "language", 3, 7, false);
|
||||||
description = ValidationUtil.validateLength(description, "description", 0, 4000, true);
|
description = ValidationUtil.validateLength(description, "description", 0, 4000, true);
|
||||||
subject = ValidationUtil.validateLength(subject, "subject", 0, 500, true);
|
subject = ValidationUtil.validateLength(subject, "subject", 0, 500, true);
|
||||||
identifier = ValidationUtil.validateLength(identifier, "identifier", 0, 500, true);
|
identifier = ValidationUtil.validateLength(identifier, "identifier", 0, 500, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user