src/org/ohmage/validator/DocumentValidators.java
public static String validateName(final String value) 
			throws ValidationException {
		
		LOGGER.info("Validating a document's name.");
		
		if(StringUtils.isEmptyOrWhitespaceOnly(value)) {
			return null;
		}
		
		if(StringUtils.isProfane(value.trim())) {
			throw new ValidationException(
					ErrorCode.DOCUMENT_INVALID_NAME, 
					"The name of this document contains profanity: " + value);
		}
		else if(! StringUtils.lengthWithinLimits(value.trim(), 0, MAX_NAME_LENGTH)) {
			throw new ValidationException(
					ErrorCode.DOCUMENT_INVALID_NAME, 
					"The name of this document is too long. The limit is " + 
						MAX_NAME_LENGTH + 
						" characters.");
		}
		else {
			return value.trim();
		}
	}
/**
	 * Validates that the name of the document is not profane and not longer 
	 * than a set length.
	 * 
	 * @param value The value to be validated.
	 * 
	 * @return Returns null if the name is null or whitespace only; otherwise,
	 * 		   it returns the name.
	 * 
	 * @throws ValidationException Thrown if the name contains profanity or is
	 * 							   too long.
	 */
Validates that the name of the document is not profane and not longer
than a set length.

@param value The value to be validated.

@return Returns null if the name is null or whitespace only; otherwise,
it returns the name.

@throws ValidationException Thrown if the name contains profanity or is
too long.
Validates that the name of the document is not profane and not longer than a set length . @param value The value to be validated . @return Returns null if the name is null or whitespace only ; otherwise it returns the name . @throws ValidationException Thrown if the name contains profanity or is too long .
public static String validateName(final String value) 
			throws ValidationException {
		LOGGER.info("Validating a document's name.");
		if(StringUtils.isEmptyOrWhitespaceOnly(value)) {
			return null;
		}
		if(StringUtils.isProfane(value.trim())) {
			throw new ValidationException(
					ErrorCode.DOCUMENT_INVALID_NAME, 
					"The name of this document contains profanity: " + value);
		}
		else if(! StringUtils.lengthWithinLimits(value.trim(), 0, MAX_NAME_LENGTH)) {
			throw new ValidationException(
					ErrorCode.DOCUMENT_INVALID_NAME, 
					"The name of this document is too long. The limit is " + 
						MAX_NAME_LENGTH + 
						" characters.");
		}
		else {
			return value.trim();
		}
	}
public static String validateName ( final String value ) throws ValidationException { LOGGER . info ( "Validating a document's name." ) ; if ( StringUtils . isEmptyOrWhitespaceOnly ( value ) ) { return null ; } if ( StringUtils . isProfane ( value . trim ( ) ) ) { throw new ValidationException ( ErrorCode . DOCUMENT_INVALID_NAME , "The name of this document contains profanity: " + value ) ; } else if ( ! StringUtils . lengthWithinLimits ( value . trim ( ) , 0 , MAX_NAME_LENGTH ) ) { throw new ValidationException ( ErrorCode . DOCUMENT_INVALID_NAME , "The name of this document is too long. The limit is " + MAX_NAME_LENGTH + " characters." ) ; } else { return value . trim ( ) ; } }
Validates that the name of the document is not profane and not longer
 than a set length.
Validates that the name of the document is not profane and not longer than a set length .