/** * Check that the releaseVersion field is not empty. * * @param releaseVersion The release version of the package. * @param project The project name * @return Ok if not empty, error otherwise. */ public FormValidation doCheckReleaseVersion( @QueryParameter String releaseVersion, @QueryParameter String project) { setGlobalConfiguration(); releaseVersion = releaseVersion.trim(); if (project == null || project.isEmpty()) { return FormValidation.warning(PROJECT_RELEASE_VALIDATION_MESSAGE); } com.octopusdeploy.api.Project p; try { p = api.getProjectByName(project); if (p == null) { return FormValidation.warning(PROJECT_RELEASE_VALIDATION_MESSAGE); } } catch (Exception ex) { return FormValidation.warning(PROJECT_RELEASE_VALIDATION_MESSAGE); } OctopusValidator validator = new OctopusValidator(api); return validator.validateRelease( releaseVersion, p.getId(), OctopusValidator.ReleaseExistenceRequirement.MustExist); }