src/org/ohmage/validator/MobilityValidators.java
public static DateTime validateDate(final String date) 
			throws ValidationException {
		
		LOGGER.info("Validating a date value.");
		
		if(StringUtils.isEmptyOrWhitespaceOnly(date)) {
			return null;
		}
		
		try {
			return DateTimeUtils.getDateTimeFromString(date);
		}
		catch(IllegalArgumentException e) {
			throw new ValidationException(
					ErrorCode.SERVER_INVALID_DATE, 
					"The date value is unknown: " + date);
		}
	}
/**
	 * Validates that the date is valid and returns it or fails the request.
	 * 
	 * @param date The date value as a string.
	 * 
	 * @return The date decoded into a Date object or null if the string was
	 * 		   null or whitespace only.
	 * 
	 * @throws ValidationException Thrown if the date string was not null, not
	 * 							   whitespace only, and not a valid date.
	 */
Validates that the date is valid and returns it or fails the request.

@param date The date value as a string.

@return The date decoded into a Date object or null if the string was
null or whitespace only.

@throws ValidationException Thrown if the date string was not null, not
whitespace only, and not a valid date.
Validates that the date is valid and returns it or fails the request . @param date The date value as a string . @return The date decoded into a Date object or null if the string was null or whitespace only . @throws ValidationException Thrown if the date string was not null not whitespace only and not a valid date .
public static DateTime validateDate(final String date) 
			throws ValidationException {
		LOGGER.info("Validating a date value.");
		if(StringUtils.isEmptyOrWhitespaceOnly(date)) {
			return null;
		}
		try {
			return DateTimeUtils.getDateTimeFromString(date);
		}
		catch(IllegalArgumentException e) {
			throw new ValidationException(
					ErrorCode.SERVER_INVALID_DATE, 
					"The date value is unknown: " + date);
		}
	}
public static DateTime validateDate ( final String date ) throws ValidationException { LOGGER . info ( "Validating a date value." ) ; if ( StringUtils . isEmptyOrWhitespaceOnly ( date ) ) { return null ; } try { return DateTimeUtils . getDateTimeFromString ( date ) ; } catch ( IllegalArgumentException e ) { throw new ValidationException ( ErrorCode . SERVER_INVALID_DATE , "The date value is unknown: " + date ) ; } }
Validates that the date is valid and returns it or fails the request.
Validates that the date is valid and returns it or fails the request .