src/org/ohmage/validator/SurveyResponseValidators.java
private static Boolean validateOptionalBoolean(final String booleanString, 
			final ErrorCode errorCode, final String errorMessage) 
			throws ValidationException {
		
		// don't validate the optional value if it doesn't exist
		if(StringUtils.isEmptyOrWhitespaceOnly(booleanString)) {
			return null;
		}

		// perform validation
		if(StringUtils.decodeBoolean(booleanString) == null) {
			throw new ValidationException(
					errorCode, 
					errorMessage + booleanString
				);
		}
		
		return Boolean.valueOf(booleanString);
	}
/**
	 * Utility for validating optional booleans where booleans must adhere to
	 * the strict values of "true" or "false" if the booleanString is not null.
	 * 
	 * @param booleanString  The string to validate.
	 * @param errorCode  The error code to use when failing the request.
	 * @param errorMessage  The error message to use when failing the request.
	 * @return A valid Boolean or null 
	 * @throws ValidationException if the booleanString cannot be strictly
	 * decoded to "true" or "false"
	 * @throws IllegalArgumentException if the request is null; if the error
	 * code is empty or null; or if the error message is empty or null.
	 */
Utility for validating optional booleans where booleans must adhere to
the strict values of "true" or "false" if the booleanString is not null.

@param booleanString  The string to validate.
@param errorCode  The error code to use when failing the request.
@param errorMessage  The error message to use when failing the request.
@return A valid Boolean or null
@throws ValidationException if the booleanString cannot be strictly
decoded to "true" or "false"
@throws IllegalArgumentException if the request is null; if the error
code is empty or null; or if the error message is empty or null.
Utility for validating optional booleans where booleans must adhere to the strict values of " true " or " false " if the booleanString is not null . @param booleanString The string to validate . @param errorCode The error code to use when failing the request . @param errorMessage The error message to use when failing the request . @return A valid Boolean or null @throws ValidationException if the booleanString cannot be strictly decoded to " true " or " false " @throws IllegalArgumentException if the request is null ; if the error code is empty or null ; or if the error message is empty or null .
private static Boolean validateOptionalBoolean(final String booleanString, 
			final ErrorCode errorCode, final String errorMessage) 
			throws ValidationException {
		if(StringUtils.isEmptyOrWhitespaceOnly(booleanString)) {
			return null;
		}
		if(StringUtils.decodeBoolean(booleanString) == null) {
			throw new ValidationException(
					errorCode, 
					errorMessage + booleanString
				);
		}
		return Boolean.valueOf(booleanString);
	}
private static Boolean validateOptionalBoolean ( final String booleanString , final ErrorCode errorCode , final String errorMessage ) throws ValidationException { if ( StringUtils . isEmptyOrWhitespaceOnly ( booleanString ) ) { return null ; } if ( StringUtils . decodeBoolean ( booleanString ) == null ) { throw new ValidationException ( errorCode , errorMessage + booleanString ) ; } return Boolean . valueOf ( booleanString ) ; }
Utility for validating optional booleans where booleans must adhere to
 the strict values of "true" or "false" if the booleanString is not null.
Utility for validating optional booleans where booleans must adhere to the strict values of " true " or " false " if the booleanString is not null .
// don't validate the optional value if it doesn't exist // perform validation