src/org/ohmage/validator/ClassValidators.java
public static String validateName(final String name) 
			throws ValidationException {
		
		LOGGER.info("Validating a class name.");
		
		if(StringUtils.isEmptyOrWhitespaceOnly(name)) {
			return null;
		}
		
		if(StringUtils.isProfane(name.trim())) {
			throw new ValidationException(
					ErrorCode.CLASS_INVALID_NAME, 
					"The class name contains profanity: " + name);
		}
		else if(! StringUtils.lengthWithinLimits(name.trim(), 0, MAX_NAME_LENGTH)) {
			throw new ValidationException(
					ErrorCode.CLASS_INVALID_NAME, 
					"The class name is too long. The maximum length of the class name is " + 
						MAX_NAME_LENGTH + 
						" characters");
		}
		else {
			return name.trim();
		}
	}
/**
	 * Validates that a class name is a valid class name by ensuring that it is
	 * not profane and not too long.
	 * 
	 * @param name The name to validate.
	 * 
	 * @return Returns null if the name is null or whitespace only; otherwise,
	 * 		   the name is returned.
	 * 
	 * @throws ValidationException Thrown if the name is profane or too long.
	 */
Validates that a class name is a valid class name by ensuring that it is
not profane and not too long.

@param name The name to validate.

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

@throws ValidationException Thrown if the name is profane or too long.
Validates that a class name is a valid class name by ensuring that it is not profane and not too long . @param name The name to validate . @return Returns null if the name is null or whitespace only ; otherwise the name is returned . @throws ValidationException Thrown if the name is profane or too long .
public static String validateName(final String name) 
			throws ValidationException {
		LOGGER.info("Validating a class name.");
		if(StringUtils.isEmptyOrWhitespaceOnly(name)) {
			return null;
		}
		if(StringUtils.isProfane(name.trim())) {
			throw new ValidationException(
					ErrorCode.CLASS_INVALID_NAME, 
					"The class name contains profanity: " + name);
		}
		else if(! StringUtils.lengthWithinLimits(name.trim(), 0, MAX_NAME_LENGTH)) {
			throw new ValidationException(
					ErrorCode.CLASS_INVALID_NAME, 
					"The class name is too long. The maximum length of the class name is " + 
						MAX_NAME_LENGTH + 
						" characters");
		}
		else {
			return name.trim();
		}
	}
public static String validateName ( final String name ) throws ValidationException { LOGGER . info ( "Validating a class name." ) ; if ( StringUtils . isEmptyOrWhitespaceOnly ( name ) ) { return null ; } if ( StringUtils . isProfane ( name . trim ( ) ) ) { throw new ValidationException ( ErrorCode . CLASS_INVALID_NAME , "The class name contains profanity: " + name ) ; } else if ( ! StringUtils . lengthWithinLimits ( name . trim ( ) , 0 , MAX_NAME_LENGTH ) ) { throw new ValidationException ( ErrorCode . CLASS_INVALID_NAME , "The class name is too long. The maximum length of the class name is " + MAX_NAME_LENGTH + " characters" ) ; } else { return name . trim ( ) ; } }
Validates that a class name is a valid class name by ensuring that it is
 not profane and not too long.
Validates that a class name is a valid class name by ensuring that it is not profane and not too long .