src/org/ohmage/validator/UserValidators.java
public static Set<String> validateUsernames(
			final String usernames) 
			throws ValidationException {
		
		LOGGER.info("Validating that a list of usernames follows our conventions.");
		
		if(StringUtils.isEmptyOrWhitespaceOnly(usernames)) {
			return null;
		}
		
		Set<String> result = new HashSet<String>();
		
		String[] usernameArray = usernames.split(InputKeys.LIST_ITEM_SEPARATOR);
		for(int i = 0; i < usernameArray.length; i++) {
			String username = validateUsername(usernameArray[i].trim());
			
			if(username != null) {
				result.add(username);
			}
		}
		
		if(result.size() == 0) {
			return null;
		}
		
		return result;
	}
/**
	 * Validates that a String representation of a list of usernames is well
	 * formed and that each of the usernames follows our conventions. It then
	 * returns the list of usernames as a List.
	 * 
	 * @param usernames A String representation of a list of usernames where 
	 * 					the usernames should be separated by
	 * 					{@value org.ohmage.request.InputKeys#LIST_ITEM_SEPARATOR}s.
	 * 
	 * @return Returns a, possibly empty, List of usernames without duplicates.
	 * 
	 * @throws ValidationException Thrown if the list is malformed or if any of
	 * 							   the items in the list is malformed.
	 */
Validates that a String representation of a list of usernames is well
formed and that each of the usernames follows our conventions. It then
returns the list of usernames as a List.

@param usernames A String representation of a list of usernames where
the usernames should be separated by
org.ohmage.request.InputKeys#LIST_ITEM_SEPARATORs.

@return Returns a, possibly empty, List of usernames without duplicates.

@throws ValidationException Thrown if the list is malformed or if any of
the items in the list is malformed.
Validates that a String representation of a list of usernames is well formed and that each of the usernames follows our conventions . It then returns the list of usernames as a List . @param usernames A String representation of a list of usernames where the usernames should be separated by org . ohmage . request . InputKeys#LIST_ITEM_SEPARATORs . @return Returns a possibly empty List of usernames without duplicates . @throws ValidationException Thrown if the list is malformed or if any of the items in the list is malformed .
public static Set<String> validateUsernames(
			final String usernames) 
			throws ValidationException {
		LOGGER.info("Validating that a list of usernames follows our conventions.");
		if(StringUtils.isEmptyOrWhitespaceOnly(usernames)) {
			return null;
		}
		Set<String> result = new HashSet<String>();
		String[] usernameArray = usernames.split(InputKeys.LIST_ITEM_SEPARATOR);
		for(int i = 0; i < usernameArray.length; i++) {
			String username = validateUsername(usernameArray[i].trim());
			if(username != null) {
				result.add(username);
			}
		}
		if(result.size() == 0) {
			return null;
		}
		return result;
	}
public static Set < String > validateUsernames ( final String usernames ) throws ValidationException { LOGGER . info ( "Validating that a list of usernames follows our conventions." ) ; if ( StringUtils . isEmptyOrWhitespaceOnly ( usernames ) ) { return null ; } Set < String > result = new HashSet < String > ( ) ; String [ ] usernameArray = usernames . split ( InputKeys . LIST_ITEM_SEPARATOR ) ; for ( int i = 0 ; i < usernameArray . length ; i ++ ) { String username = validateUsername ( usernameArray [ i ] . trim ( ) ) ; if ( username != null ) { result . add ( username ) ; } } if ( result . size ( ) == 0 ) { return null ; } return result ; }
Validates that a String representation of a list of usernames is well
 formed and that each of the usernames follows our conventions.
Validates that a String representation of a list of usernames is well formed and that each of the usernames follows our conventions .