Merge branch 'master' into sismics_prod

This commit is contained in:
Benjamin Gamard 2017-10-31 21:01:32 +01:00
commit 3b1f11e5a8
2 changed files with 7 additions and 8 deletions

View File

@ -1,15 +1,14 @@
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.util.Date;
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.
*
@ -58,7 +57,7 @@ public class ValidationUtil {
throw new ClientException("ValidationError", MessageFormat.format("{0} must be more than {1} characters", name, lengthMin));
}
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;
}

View File

@ -574,7 +574,7 @@ public class DocumentResource extends BaseResource {
// Validate input data
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);
subject = ValidationUtil.validateLength(subject, "subject", 0, 500, true);
identifier = ValidationUtil.validateLength(identifier, "identifier", 0, 500, true);