Skip to content

Instantly share code, notes, and snippets.

@jorgenpt
Created October 26, 2011 03:59
Show Gist options
  • Save jorgenpt/1315395 to your computer and use it in GitHub Desktop.
Save jorgenpt/1315395 to your computer and use it in GitHub Desktop.
public FormValidation doCheckOsVersion(@QueryParameter String value) {
return doCheckOsVersion(value, true).getFormValidation();
}
private ValidationResult doCheckOsVersion(String osVersion, boolean allowVariables) {
if (osVersion == null || osVersion.equals("")) {
return ValidationResult.error(Messages.OS_VERSION_REQUIRED());
}
if (!allowVariables && osVersion.matches(Constants.REGEX_VARIABLE)) {
return ValidationResult.error(Messages.INVALID_OS_VERSION());
}
return ValidationResult.ok();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment