/** * Sends out a string error message that indicates an error. * * @param message * Human readable message to be sent. {@code error(null)} * can be used as {@code ok()}. */ public static FormValidation error(String message) { return errorWithMarkup(message==null?null: Util.escape(message)); }
/** * If the user chose the default JDK, make sure we got 'java' in PATH. */ public FormValidation doDefaultJDKCheck(StaplerRequest request, @QueryParameter String value) { if(!JDK.isDefaultName(value)) // assume the user configured named ones properly in system config --- // or else system config should have reported form field validation errors. return FormValidation.ok(); // default JDK selected. Does such java really exist? if(JDK.isDefaultJDKValid(Jenkins.this)) return FormValidation.ok(); else return FormValidation.errorWithMarkup(Messages.Hudson_NoJavaInPath(request.getContextPath())); }
.withDuringActionExceptionListener( (attempt, e) -> FormValidation.errorWithMarkup(e.getClass().getSimpleName() + ": " + e.getLocalizedMessage()))
public FormValidation doCheckPolicyName(@QueryParameter String value) { if (value == null || value.equals("empty")) { // Todo: optimize the message return FormValidation.errorWithMarkup("Fail to get the policies, please check your username/password or org name and make sure you have created policies for this org and toolchain."); } return FormValidation.ok(); }
/** * Sends out a string error message that indicates an error. * * @param message * Human readable message to be sent. <tt>error(null)</tt> * can be used as <tt>ok()</tt>. */ public static FormValidation error(String message) { return errorWithMarkup(message==null?null: Util.escape(message)); }
/** * Sends out a string error message that indicates an error. * * @param message * Human readable message to be sent. <tt>error(null)</tt> * can be used as <tt>ok()</tt>. */ public static FormValidation error(String message) { return errorWithMarkup(message==null?null: Util.escape(message)); }
/** * Sends out a string error message that indicates an error. * * @param message Human readable message to be sent. <tt>error(null)</tt> * can be used as <tt>ok()</tt>. */ public static FormValidation error(String message) { return errorWithMarkup(message == null ? null : Util.escape(message)); }
public FormValidation doCheckPolicyName(@QueryParameter String value) { if (value == null || value.equals("empty")) { return FormValidation.errorWithMarkup(getMessage(FAIL_TO_GET_POLICY_LIST)); } return FormValidation.ok(); }
/** * Sends out a string error message that indicates an error. * * @param message * Human readable message to be sent. <tt>error(null)</tt> * can be used as <tt>ok()</tt>. */ public static FormValidation error(String message) { return errorWithMarkup(message==null?null: Util.escape(message)); }
/** * Sends out a string error message that indicates an error. * * @param message * Human readable message to be sent. <tt>error(null)</tt> * can be used as <tt>ok()</tt>. */ public static FormValidation error(String message) { return errorWithMarkup(message==null?null: Util.escape(message)); }
public FormValidation getFormValidation() { switch (type) { case WARNING: return FormValidation.warning(message); case ERROR: if (hasMarkup) { return FormValidation.errorWithMarkup(message); } else { return FormValidation.error(message); } case OK: default: return FormValidation.ok(); } }
public FormValidation doCheckToolchainName(@QueryParameter String value) throws IOException, ServletException { if (value == null || value.equals("empty")) { return FormValidation.errorWithMarkup(getMessageWithPrefix(TOOLCHAIN_ID_IS_REQUIRED)); } return FormValidation.validateRequired(value); }
public FormValidation doCheckToolchainName(@QueryParameter String value) throws IOException, ServletException { if (value == null || value.equals("empty")) { return FormValidation.errorWithMarkup(getMessageWithPrefix(TOOLCHAIN_ID_IS_REQUIRED)); } return FormValidation.validateRequired(value); }
public FormValidation doCheckToolchainName(@QueryParameter String value) throws IOException, ServletException { if (value == null || value.equals("empty")) { return FormValidation.errorWithMarkup(getMessageWithPrefix(TOOLCHAIN_ID_IS_REQUIRED)); } return FormValidation.validateRequired(value); }
/** * If the user chose the default JDK, make sure we got 'java' in PATH. */ public FormValidation doDefaultJDKCheck(StaplerRequest request, @QueryParameter String value) { if (!value.equals("(Default)")) // assume the user configured named ones properly in system config --- // or else system config should have reported form field validation errors. { return FormValidation.ok(); } // default JDK selected. Does such java really exist? if (JDK.isDefaultJDKValid(Hudson.this)) { return FormValidation.ok(); } else { return FormValidation.errorWithMarkup(Messages.Hudson_NoJavaInPath(request.getContextPath())); } }
/** * If the user chose the default JDK, make sure we got 'java' in PATH. */ public FormValidation doDefaultJDKCheck(StaplerRequest request, @QueryParameter String value) { if (!value.equals("(Default)")) // assume the user configured named ones properly in system config --- // or else system config should have reported form field validation errors. { return FormValidation.ok(); } // default JDK selected. Does such java really exist? if (JDK.isDefaultJDKValid(Hudson.this)) { return FormValidation.ok(); } else { return FormValidation.errorWithMarkup(Messages.Hudson_NoJavaInPath(request.getContextPath())); } }
/** * If the user chose the default JDK, make sure we got 'java' in PATH. */ public FormValidation doDefaultJDKCheck(StaplerRequest request, @QueryParameter String value) { if (!value.equals("(Default)")) // assume the user configured named ones properly in system config --- // or else system config should have reported form field validation errors. { return FormValidation.ok(); } // default JDK selected. Does such java really exist? if (JDK.isDefaultJDKValid(Hudson.this)) { return FormValidation.ok(); } else { return FormValidation.errorWithMarkup(Messages.Hudson_NoJavaInPath(request.getContextPath())); } }
/** * Checks that the supplied URL is valid. * * @param value the URL to check. * @return the validation results. */ public static FormValidation doCheckAliasUrl(@QueryParameter String value) { Jenkins.getActiveInstance().checkPermission(Jenkins.ADMINISTER); if (StringUtils.isBlank(value)) return FormValidation.ok(); try { new URI(value); return FormValidation.ok(); } catch (URISyntaxException e) { return FormValidation.errorWithMarkup(Messages.GiteaServer_invalidUrl(Util.escape(e.getMessage()))); } }
/** * If the user chose the default JDK, make sure we got 'java' in PATH. */ public FormValidation doDefaultJDKCheck(StaplerRequest request, @QueryParameter String value) { if(!JDK.isDefaultName(value)) // assume the user configured named ones properly in system config --- // or else system config should have reported form field validation errors. return FormValidation.ok(); // default JDK selected. Does such java really exist? if(JDK.isDefaultJDKValid(Jenkins.this)) return FormValidation.ok(); else return FormValidation.errorWithMarkup(Messages.Hudson_NoJavaInPath(request.getContextPath())); }
public FormValidation doCheckAcceptLicense(@QueryParameter boolean value) { if (username==null || password==null) return FormValidation.errorWithMarkup(Messages.JDKInstaller_RequireOracleAccount(Stapler.getCurrentRequest().getContextPath()+'/'+getDescriptorUrl()+"/enterCredential")); if (value) { return FormValidation.ok(); } else { return FormValidation.error(Messages.JDKInstaller_DescriptorImpl_doCheckAcceptLicense()); } }