/** * Renames this item */ @RequirePOST @Restricted(NoExternalUse.class) public HttpResponse doConfirmRename(@QueryParameter String newName) throws IOException { newName = newName == null ? null : newName.trim(); FormValidation validationError = doCheckNewName(newName); if (validationError.kind != FormValidation.Kind.OK) { throw new Failure(validationError.getMessage()); } renameTo(newName); // send to the new job page // note we can't use getUrl() because that would pick up old name in the // Ancestor.getUrl() return HttpResponses.redirectTo("../" + newName); }
LOGGER.log(Level.SEVERE, Messages.PluginManager_UpdateSiteError(CHECK_UPDATE_ATTEMPTS, result.getMessage())); if (CHECK_UPDATE_ATTEMPTS > 1 && !Logger.getLogger(Retrier.class.getName()).isLoggable(Level.WARNING)) { LOGGER.log(Level.SEVERE, Messages.PluginManager_UpdateSiteChangeLogLevel(Retrier.class.getName())); lastErrorCheckUpdateCenters = Messages.PluginManager_CheckUpdateServerError(result.getMessage()); } else { lastErrorCheckUpdateCenters = null;
public boolean matches(Object o) { FormValidation v = (FormValidation) o; return v.getMessage().contains(cause.getName()); }
@Override public AbstractProjectReference newInstance( StaplerRequest req, JSONObject formData) throws FormException { String targetJob = formData.getString("targetJob"); String variance = formData.getString("variance"); FormValidation formValidation = doCheckVariance(formData.getString("variance")); if (formValidation.kind != FormValidation.Kind.OK) { throw new FormException( formValidation.getMessage(), "variance" ); } Object jParams = formData.get("parameters"); List<ParameterDefinition> params = ParameterDescriptor.newInstancesFromHeteroList( req, jParams, ParameterDefinition.all() ); return new ParameterizedProjectReference(targetJob, variance, params); }
@Override public boolean canProvision(Label label) { LOGGER.info("Checking label: " + label); final List<PodSlaveConfigurationParams> podSlaveConfigurationParams = new ArrayList<>(); for (PodSlaveConfig config: podSlaveConfigurations) { podSlaveConfigurationParams.add(config.getPodSlaveConfigurationParams()); } try { FormValidation testConnection = ((DescriptorImpl) getDescriptor()).doTestConnection( getEndpointUrl(), getPredefinedNamespace(), getCredentialsId(), null); if (testConnection.kind == FormValidation.Kind.ERROR) { LOGGER.warning("Unable to connect to: " + this + testConnection.getMessage() ); return false; } return slaveProvisioningService.canProvision(KubernetesCloud.this, podSlaveConfigurationParams, label); } catch (ServiceException exception) { LOGGER.info("Error while checking if provision is allowed"); return false; } }
/** * Verifies that Axis names are valid and unique. */ private void checkAxes(Iterable<Axis> newAxes) throws FormException { HashSet<String> axisNames = new HashSet<String>(); for (Axis a : newAxes) { final AxisDescriptor desc = a.getDescriptor(); FormValidation fv = desc.doCheckName(a.getName()); if (fv.kind!=Kind.OK) { final String msg = Messages.MatrixProject_InvalidAxisName(a.getName(), fv.getMessage()); throw new FormException(msg,fv,"axis.name"); } for (String value: a.getValues()) { fv = desc.checkValue(value); if (fv.kind!=Kind.OK) { final String msg = Messages.MatrixProject_InvalidAxisValue(value, fv.getMessage()); // This is done on wrong place, MatrixProject is not supposed // to know field names of arbitrary axis implementations throw new FormException(msg,fv,"axis.value"); } } if (axisNames.contains(a.getName())) throw new FormException(Messages.MatrixProject_DuplicateAxisName(),"axis.name"); axisNames.add(a.getName()); } }