// Path: home-web-common/src/main/java/com/sismics/rest/exception/ClientException.java
// public class ClientException extends WebApplicationException {
//     /**
//      * Serial UID.
//      */
//     private static final long serialVersionUID = 1L;
// 
//     /**
//      * Logger.
//      */
//     private static final Logger log = LoggerFactory.getLogger(ClientException.class);
// 
//     /**
//      * Constructor of ClientException.
//      * 
//      * @param type Error type (e.g. AlreadyExistingEmail, ValidationError)
//      * @param message Human readable error message
//      * @param e Readable error message
//      */
//     public ClientException(String type, String message, Exception e) {
//         this(type, message);
//         log.error(type + ": " + message, e);
//     }
// 
//     /**
//      * Constructor of ClientException.
//      * 
//      * @param type Error type (e.g. AlreadyExistingEmail, ValidationError)
//      * @param message Human readable error message
//      */
//     public ClientException(String type, String message) {
//         super(Response.status(Status.BAD_REQUEST).entity(Json.createObjectBuilder()
//             .add("type", type)
//             .add("message", message).build()).build());
//     }
// }


import java.io.File;
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;
     * @param s String to validate
     * @param name Name of the parameter
     * @param lengthMin Minimum length (or null)
     * @param lengthMax Maximum length (or null)
     * @return String without white spaces
     * @throws ClientException
     */
    public static String validateLength(String s, String name, Integer lengthMin, Integer lengthMax) throws ClientException {
        return validateLength(s, name, lengthMin, lengthMax, false);
    }
    
    /**
     * Checks if the string is not null and is not only whitespaces.
     * 
     * @param s String to validate
     * @param name Name of the parameter
     * @return String without white spaces
     * @throws ClientException
     */
    public static String validateStringNotBlank(String s, String name) throws ClientException {
        return validateLength(s, name, 1, null, false);
    }
    
    /**
     * Checks if the string is an email.
     * 
     * @param s String to validate
     * @param name Name of the parameter
     * @throws ClientException
     */
// Path: home-web-common/src/main/java/com/sismics/rest/exception/ClientException.java
// public class ClientException extends WebApplicationException {
//     /**
//      * Serial UID.
//      */
//     private static final long serialVersionUID = 1L;
// 
//     /**
//      * Logger.
//      */
//     private static final Logger log = LoggerFactory.getLogger(ClientException.class);
// 
//     /**
//      * Constructor of ClientException.
//      * 
//      * @param type Error type (e.g. AlreadyExistingEmail, ValidationError)
//      * @param message Human readable error message
//      * @param e Readable error message
//      */
//     public ClientException(String type, String message, Exception e) {
//         this(type, message);
//         log.error(type + ": " + message, e);
//     }
// 
//     /**
//      * Constructor of ClientException.
//      * 
//      * @param type Error type (e.g. AlreadyExistingEmail, ValidationError)
//      * @param message Human readable error message
//      */
//     public ClientException(String type, String message) {
//         super(Response.status(Status.BAD_REQUEST).entity(Json.createObjectBuilder()
//             .add("type", type)
//             .add("message", message).build()).build());
//     }
// }


// Path: home-web-common/src/main/java/com/sismics/rest/util/ValidationUtil.java
import java.io.File;
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;

     * @param s String to validate
     * @param name Name of the parameter
     * @param lengthMin Minimum length (or null)
     * @param lengthMax Maximum length (or null)
     * @return String without white spaces
     * @throws ClientException
     */
    public static String validateLength(String s, String name, Integer lengthMin, Integer lengthMax) throws ClientException {
        return validateLength(s, name, lengthMin, lengthMax, false);
    }
    
    /**
     * Checks if the string is not null and is not only whitespaces.
     * 
     * @param s String to validate
     * @param name Name of the parameter
     * @return String without white spaces
     * @throws ClientException
     */
    public static String validateStringNotBlank(String s, String name) throws ClientException {
        return validateLength(s, name, 1, null, false);
    }
    
    /**
     * Checks if the string is an email.
     * 
     * @param s String to validate
     * @param name Name of the parameter
     * @throws ClientException
     */
    public static void validateEmail(String s, String name) throws ClientException {