public FormValidation doCheckReposUrl(@QueryParameter String value) {
   FormValidation result;
   final Matcher matcher = URL_PATTERN.matcher(value);
   if (matcher.matches()) {
     try {
       final URL repUrl = new URL(matcher.group(URL_PATTERN_BASE_URL_GROUP));
       final String repName = matcher.group(URL_PATTERN_REPNAME_GROUP);
       if (repName == null || "".equals(repName)) { // Go online??
         result =
             FormValidation.okWithMarkup(
                 "Please set a url including the repname property if needed.");
       } else {
         result = FormValidation.ok();
       }
     } catch (MalformedURLException ex) {
       result =
           FormValidation.error("The entered url is not accepted: " + ex.getLocalizedMessage());
     }
   } else if ("".equals(value)) {
     result =
         FormValidation.okWithMarkup(
             "Please set a WebSVN url in the form "
                 + "https://<i>server</i>/websvn/listing.php?repname=<i>rep</i>&path=/trunk/..");
   } else {
     result = FormValidation.error("Please set a url including the WebSVN php script.");
   }
   return result;
 }
    // Form validation
    @SuppressWarnings({"ThrowableResultOfMethodCallIgnored", "unused"})
    public FormValidation doTestConnection(
        @QueryParameter(CLIENT_ID) final String clientId,
        @QueryParameter(CLIENT_SECRET) final String clientSecret,
        @QueryParameter(BASE_URL) final String baseUrl) {
      if (clientId == null || clientId.isEmpty()) return FormValidation.error("API Key is empty!");
      if (clientSecret == null || clientSecret.isEmpty())
        return FormValidation.error("Secret Key is empty!");
      if (baseUrl == null || baseUrl.isEmpty())
        return FormValidation.error("Fortify on Demand URL is empty!");

      FodApi testApi = new FodApi(clientId, clientSecret, baseUrl);

      testApi.authenticate();
      String token = testApi.getToken();

      if (token == null) {
        return FormValidation.error("Unable to retrieve authentication token.");
      }

      return !token.isEmpty()
          ? FormValidation.ok("Successfully authenticated to Fortify on Demand.")
          : FormValidation.error(
              "Invalid connection information. Please check your credentials and try again.");
    }
Ejemplo n.º 3
0
 public FormValidation doTestConnection(
     @QueryParameter("slackTeamDomain") final String teamDomain,
     @QueryParameter("slackToken") final String authToken,
     @QueryParameter("slackRoom") final String room,
     @QueryParameter("slackBuildServerUrl") final String buildServerUrl)
     throws FormException {
   try {
     String targetDomain = teamDomain;
     if (StringUtils.isEmpty(targetDomain)) {
       targetDomain = this.teamDomain;
     }
     String targetToken = authToken;
     if (StringUtils.isEmpty(targetToken)) {
       targetToken = this.token;
     }
     String targetRoom = room;
     if (StringUtils.isEmpty(targetRoom)) {
       targetRoom = this.room;
     }
     String targetBuildServerUrl = buildServerUrl;
     if (StringUtils.isEmpty(targetBuildServerUrl)) {
       targetBuildServerUrl = this.buildServerUrl;
     }
     SlackService testSlackService = getSlackService(targetDomain, targetToken, targetRoom);
     String message = "Slack/Jenkins plugin: you're all set on " + targetBuildServerUrl;
     boolean success = testSlackService.publish(message, "good");
     return success ? FormValidation.ok("Success") : FormValidation.error("Failure");
   } catch (Exception e) {
     return FormValidation.error("Client error : " + e.getMessage());
   }
 }
Ejemplo n.º 4
0
    protected FormValidation doTestConnection(
        URL ec2endpoint,
        boolean useInstanceProfileForCredentials,
        String accessId,
        String secretKey,
        String privateKey)
        throws IOException, ServletException {
      try {
        AWSCredentialsProvider credentialsProvider =
            createCredentialsProvider(useInstanceProfileForCredentials, accessId, secretKey);
        AmazonEC2 ec2 = connect(credentialsProvider, ec2endpoint);
        ec2.describeInstances();

        if (privateKey == null)
          return FormValidation.error(
              "Private key is not specified. Click 'Generate Key' to generate one.");

        if (privateKey.trim().length() > 0) {
          // check if this key exists
          EC2PrivateKey pk = new EC2PrivateKey(privateKey);
          if (pk.find(ec2) == null)
            return FormValidation.error(
                "The EC2 key pair private key isn't registered to this EC2 region (fingerprint is "
                    + pk.getFingerprint()
                    + ")");
        }

        return FormValidation.ok(Messages.EC2Cloud_Success());
      } catch (AmazonClientException e) {
        LOGGER.log(Level.WARNING, "Failed to check EC2 credential", e);
        return FormValidation.error(e.getMessage());
      }
    }
Ejemplo n.º 5
0
  public FormValidation validate() throws IOException {

    HttpClient hc = createClient();

    PostMethod post = new PostMethod(url + "Login");
    post.addParameter("userName", getUsername());

    if (getPassword() != null) {
      //          post.addParameter("password",getPassword());
      post.addParameter("password", getPassword().getPlainText());
    } else {
      post.addParameter("password", "");
    }

    hc.executeMethod(post);

    // if the login succeeds, we'll see a redirect
    Header loc = post.getResponseHeader("Location");
    if (loc != null && loc.getValue().endsWith("/Central")) return FormValidation.ok("Success!");

    if (!post.getResponseBodyAsString().contains("SOASTA"))
      return FormValidation.error(getUrl() + " doesn't look like a CloudTest server");

    // if it fails, the server responds with 200!
    return FormValidation.error("Invalid credentials.");
  }
Ejemplo n.º 6
0
    public FormValidation doCheckUrl(
        @AncestorInPath Item project,
        @QueryParameter String credentialsId,
        @QueryParameter String value)
        throws IOException, InterruptedException {

      if (project == null || !project.hasPermission(Item.CONFIGURE)) {
        return FormValidation.ok();
      }

      String url = Util.fixEmptyAndTrim(value);
      if (url == null) return FormValidation.error("Please enter repository url.");

      // get git executable on master
      final EnvVars environment = new EnvVars(EnvVars.masterEnvVars);

      GitClient git =
          Git.with(TaskListener.NULL, environment)
              .using(GitTool.getDefaultInstallation().getGitExe())
              .getClient();
      if (credentialsId != null) {
        StandardCredentials credentials = lookupCredentials(project, credentialsId, url);
        if (credentials != null) git.addDefaultCredentials(credentials);
      }

      // attempt to connect the provided URL
      try {
        git.getHeadRev(url, "HEAD");
      } catch (GitException e) {
        return FormValidation.error(Messages.UserRemoteConfig_FailedToConnect(e.getMessage()));
      }

      return FormValidation.ok();
    }
 public FormValidation doValidate(
     @QueryParameter String username,
     @QueryParameter String apiKey,
     @QueryParameter boolean disableStatusColumn,
     @QueryParameter boolean reuseSauceAuth) {
   try {
     SauceOnDemandAuthentication credential =
         reuseSauceAuth
             ? new SauceOnDemandAuthentication()
             : new SauceOnDemandAuthentication(
                 username, Secret.toString(Secret.fromString(apiKey)));
     // we aren't interested in the results of the REST API call - just the fact that we executed
     // without an error is enough to verify the connection
     if (reuseSauceAuth
         && StringUtils.isBlank(credential.getUsername())
         && StringUtils.isBlank(credential.getAccessKey())) {
       return FormValidation.error("Unable to find ~/.sauce-ondemand file");
     } else {
       String response =
           new SauceREST(credential.getUsername(), credential.getAccessKey())
               .retrieveResults("tunnels");
       if (response != null && !response.equals("")) {
         return FormValidation.ok("Success");
       } else {
         return FormValidation.error("Failed to connect to Sauce OnDemand");
       }
     }
   } catch (Exception e) {
     return FormValidation.error(e, "Failed to connect to Sauce OnDemand");
   }
 }
    /** Form validation method. */
    @SuppressWarnings("rawtypes")
    public FormValidation doCheckSourceProject(
        @AncestorInPath AccessControlled subject, @QueryParameter String value) {
      // Require CONFIGURE permission on this project
      if (!subject.hasPermission(Item.CONFIGURE)) return FormValidation.ok();

      if (value == null) return FormValidation.ok();

      value = value.trim();

      if (value.equals("")) {
        return FormValidation.error("This field is required");
      }

      Item item = Hudson.getInstance().getItem(value);
      if (item == null)
        return FormValidation.error(
            "No such project '"
                + value
                + "'. Did you mean '"
                + AbstractProject.findNearest(value).getName()
                + "' ?");
      if (item instanceof Job && (((AbstractProject) item).getScm() instanceof GitSCM)) {
        return FormValidation.ok();
      }

      return FormValidation.error("'" + value + "' is not a Git project");
    }
    public FormValidation doCheckWorkflowName(
        @QueryParameter final String serverUrl,
        @QueryParameter final String userName,
        @QueryParameter final String password,
        @QueryParameter final String tenant,
        @QueryParameter final String workflowName)
        throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException, IOException,
            URISyntaxException {

      String workflowNameValue = Util.fixEmptyAndTrim(workflowName);
      if (workflowNameValue == null) {
        return FormValidation.error("Please enter workflow name.");
      }

      if (workflowNameValue.indexOf('$') >= 0) {
        // set by variable, can't validate
        return FormValidation.ok();
      }
      // Call server and validate
      BuildParam buildParam = new BuildParam(serverUrl, userName, password, tenant, null);
      OrchestratorClient client = new OrchestratorClient(buildParam);
      List<Workflow> workflows = client.fetchWorkflows();

      boolean isWorkflowFound = false;
      for (Workflow workflow : workflows) {
        if (workflow.getName().equals(workflowName)) {
          isWorkflowFound = true;
        }
      }
      if (!isWorkflowFound) {
        return FormValidation.error("Workflow with the given name doesn't exist in the server.");
      }
      return FormValidation.ok();
    }
Ejemplo n.º 10
0
    /**
     * For test Server Address if it available
     *
     * @param value String from Server Address form
     * @return OK if ping, ERROR otherwise
     */
    public FormValidation doCheckServerAddress(@QueryParameter String value) {

      try {

        if (value == null || value.matches("\\s*")) {
          return FormValidation.warning("Set Address");
        }

        if (value.startsWith("$")) {
          return FormValidation.ok();
        }

        new Socket(value, 22).close();

      } catch (UnknownHostException e) {
        return FormValidation.error("Unknown Host\t" + value + "\t" + e.getLocalizedMessage());
      } catch (IOException e) {
        return FormValidation.error(
            "Input Output Exception while connecting to \t"
                + value
                + "\t"
                + e.getLocalizedMessage());
      }
      return FormValidation.ok();
    }
 /**
  * Check method to validate the authentication details
  *
  * @param request the {@link StaplerRequest}
  * @return the {@link FormValidation} result
  * @throws IOException in case of IO exceptions
  */
 public FormValidation doLoginCheck(StaplerRequest request) throws IOException {
   String url = Util.fixEmpty(request.getParameter("url"));
   if (url == null) {
     return FormValidation.ok();
   }
   JIRASite site =
       new JIRASite(
           "Login Check",
           new URL(url),
           request.getParameter("user"),
           request.getParameter("pass"),
           false,
           null,
           false);
   try {
     site.createClient();
     return FormValidation.ok();
   } catch (RemoteAuthenticationException e) {
     return FormValidation.error(e.getMessage());
   } catch (AxisFault e) {
     return FormValidation.error(e.getFaultString());
   } catch (ServiceException e) {
     return FormValidation.error(e.getMessage());
   }
 }
Ejemplo n.º 12
0
    public FormValidation doTestConnection(
        @QueryParameter("hygieiaAPIUrl") final String hygieiaAPIUrl,
        @QueryParameter("hygieiaToken") final String hygieiaToken,
        @QueryParameter("hygieiaJenkinsName") final String hygieiaJenkinsName,
        @QueryParameter("useProxy") final String sUseProxy)
        throws FormException {

      String hostUrl = hygieiaAPIUrl;
      if (StringUtils.isEmpty(hostUrl)) {
        hostUrl = this.hygieiaAPIUrl;
      }
      String targetToken = hygieiaToken;
      if (StringUtils.isEmpty(targetToken)) {
        targetToken = this.hygieiaToken;
      }
      String name = hygieiaJenkinsName;
      if (StringUtils.isEmpty(name)) {
        name = this.hygieiaJenkinsName;
      }
      boolean bProxy = "true".equalsIgnoreCase(sUseProxy);
      if (StringUtils.isEmpty(sUseProxy)) {
        bProxy = this.useProxy;
      }
      HygieiaService testHygieiaService = getHygieiaService(hostUrl, targetToken, name, bProxy);
      if (testHygieiaService != null) {
        boolean success = testHygieiaService.testConnection();
        return success ? FormValidation.ok("Success") : FormValidation.error("Failure");
      } else {
        return FormValidation.error("Failure");
      }
    }
Ejemplo n.º 13
0
    public FormValidation doVerifyConfiguration(
        @QueryParameter String subscriptionId,
        @QueryParameter String serviceManagementCert,
        @QueryParameter String passPhrase,
        @QueryParameter String serviceManagementURL) {

      if (AzureUtil.isNull(subscriptionId)) {
        return FormValidation.error("Error: Subscription ID is missing");
      }

      if (AzureUtil.isNull(serviceManagementCert)) {
        return FormValidation.error("Error: Management service certificate is missing");
      }

      if (AzureUtil.isNull(serviceManagementURL)) {
        serviceManagementURL = Constants.DEFAULT_MANAGEMENT_URL;
      }

      String response =
          AzureManagementServiceDelegate.verifyConfiguration(
              subscriptionId, serviceManagementCert, passPhrase, serviceManagementURL);

      if (response.equalsIgnoreCase("Success")) {
        return FormValidation.ok(Messages.Azure_Config_Success());
      } else {
        return FormValidation.error(response);
      }
    }
    public FormValidation doServerCheck(
        @QueryParameter final String server,
        @QueryParameter final String managerDN,
        @QueryParameter final String managerPassword) {

      if (!Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER)) return FormValidation.ok();

      try {
        Hashtable<String, String> props = new Hashtable<String, String>();
        if (managerDN != null && managerDN.trim().length() > 0 && !"undefined".equals(managerDN)) {
          props.put(Context.SECURITY_PRINCIPAL, managerDN);
        }
        if (managerPassword != null
            && managerPassword.trim().length() > 0
            && !"undefined".equals(managerPassword)) {
          props.put(Context.SECURITY_CREDENTIALS, managerPassword);
        }

        props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
        props.put(Context.PROVIDER_URL, toProviderUrl(server, ""));

        DirContext ctx = new InitialDirContext(props);
        ctx.getAttributes("");
        return FormValidation.ok(); // connected
      } catch (NamingException e) {
        // trouble-shoot
        Matcher m =
            Pattern.compile(
                    "(ldaps?://)?([^:]+)(?:\\:(\\d+))?(\\s+(ldaps?://)?([^:]+)(?:\\:(\\d+))?)*")
                .matcher(server.trim());
        if (!m.matches())
          return FormValidation.error(
              hudson.security.Messages.LDAPSecurityRealm_SyntaxOfServerField());

        try {
          InetAddress adrs = InetAddress.getByName(m.group(2));
          int port = m.group(1) != null ? 636 : 389;
          if (m.group(3) != null) port = Integer.parseInt(m.group(3));
          Socket s = new Socket(adrs, port);
          s.close();
        } catch (UnknownHostException x) {
          return FormValidation.error(
              hudson.security.Messages.LDAPSecurityRealm_UnknownHost(x.getMessage()));
        } catch (IOException x) {
          return FormValidation.error(
              x,
              hudson.security.Messages.LDAPSecurityRealm_UnableToConnect(server, x.getMessage()));
        }

        // otherwise we don't know what caused it, so fall back to the general error report
        // getMessage() alone doesn't offer enough
        return FormValidation.error(
            e, hudson.security.Messages.LDAPSecurityRealm_UnableToConnect(server, e));
      } catch (NumberFormatException x) {
        // The getLdapCtxInstance method throws this if it fails to parse the port number
        return FormValidation.error(hudson.security.Messages.LDAPSecurityRealm_InvalidPortNumber());
      }
    }
Ejemplo n.º 15
0
 public FormValidation doCheckUrl(@QueryParameter String value) {
   if (value == null || value.trim().isEmpty()) {
     return FormValidation.error("Required.");
   } else if (!isValidURL(value)) {
     return FormValidation.error("Invalid URL syntax (did you mean http://" + value + " ?");
   } else {
     return FormValidation.ok();
   }
 }
 public FormValidation doCheckName(@QueryParameter String name) {
   if (Strings.isNullOrEmpty(name)) {
     return FormValidation.error("Must be set");
   } else if (!DropletName.isValidSlaveName(name)) {
     return FormValidation.error("Must consist of A-Z, a-z, 0-9 and . symbols");
   } else {
     return FormValidation.ok();
   }
 }
  public FormValidation doCheckBackupPath(
      final StaplerRequest res,
      final StaplerResponse rsp,
      @QueryParameter("value") final String path) {
    if ((path == null) || path.trim().isEmpty()) {
      return FormValidation.error("Backup path must not be empty.");
    }

    String expandedPathMessage = "";
    String expandedPath = "";
    try {
      expandedPath = Utils.expandEnvironmentVariables(path);
    } catch (final EnvironmentVariableNotDefinedException evnd) {
      return FormValidation.error(evnd.getMessage());
    }
    if (!expandedPath.equals(path)) {
      expandedPathMessage = String.format("The path will be expanded to '%s'.\n\n", expandedPath);
    }

    final File backupdir = new File(expandedPath);
    if (!backupdir.exists()) {
      return FormValidation.warning(
          expandedPathMessage
              + "The directory does not exist, but will be created before the first run.");
    }
    if (!backupdir.isDirectory()) {
      return FormValidation.error(
          expandedPathMessage
              + "A file with this name exists, thus a directory with the same name cannot be created.");
    }
    final File tmp = new File(expandedPath + File.separator + "test.txt");
    try {
      tmp.createNewFile();
    } catch (final Exception e) {
      if (!tmp.canWrite()) {
        return FormValidation.error(
            expandedPathMessage + "The directory exists, but is not writable.");
      }
    } finally {
      if (tmp.exists()) {
        tmp.delete();
      }
    }
    if (!expandedPath.trim().equals(expandedPath)) {
      return FormValidation.warning(
          expandedPathMessage
              + "Path contains leading and/or trailing whitespaces - is this intentional?");
    }

    if (!expandedPathMessage.isEmpty()) {
      return FormValidation.warning(
          expandedPathMessage.substring(0, expandedPathMessage.length() - 2));
    }

    return FormValidation.ok();
  }
Ejemplo n.º 18
0
 public FormValidation doTest() {
   try {
     String message = NativeUtils.getInstance().checkPamAuthentication();
     if (message.startsWith("Error:")) {
       return FormValidation.error(message.replaceFirst("Error:", ""));
     } else {
       return FormValidation.ok(message);
     }
   } catch (NativeAccessException exc) {
     return FormValidation.error("Native Support for PAM Authentication not available.");
   }
 }
Ejemplo n.º 19
0
    public FormValidation doCheckMaxExecutors(
        @QueryParameter String minExecutors, @QueryParameter String maxExecutors) {
      int minExecutorsVal = Integer.parseInt(minExecutors);
      int maxExecutorsVal = Integer.parseInt(maxExecutors);

      if (maxExecutorsVal < 1) {
        return FormValidation.error("maxExecutors must at least be equal to 1.");
      } else if (maxExecutorsVal < minExecutorsVal) {
        return FormValidation.error("maxExecutors must be higher than minExecutors.");
      } else {
        return FormValidation.ok();
      }
    }
 /**
  * Checks that the pattern is a valid regexp.
  *
  * @param value the pattern to check.
  * @return {@link hudson.util.FormValidation#ok()} if everything is well.
  */
 public static FormValidation checkPattern(@QueryParameter String value) {
   if (value == null || value.isEmpty()) {
     return FormValidation.error("Please provide a pattern!");
   }
   try {
     Pattern.compile(value);
     return FormValidation.ok();
   } catch (PatternSyntaxException e) {
     return FormValidation.error("Bad syntax! " + e.getMessage());
   } catch (Exception e) {
     return FormValidation.warning("Unpredicted error. " + e.getMessage());
   }
 }
 public FormValidation doCheckSolrCollection(
     @QueryParameter final String solrCollection, @QueryParameter String solrUrl) {
   try {
     List<String> collections = getCollections(solrUrl);
     if (collections.contains(solrCollection)) {
       return FormValidation.ok();
     } else {
       return FormValidation.error("Collection not found among: " + collections);
     }
   } catch (IOException e) {
     return FormValidation.error(e.getMessage());
   }
 }
 /**
  * Check that the PYTHON name is specified
  *
  * @param value The value to check
  */
 public FormValidation doCheckName(@QueryParameter String value) {
   // Trim name
   String name = Util.fixEmptyAndTrim(value);
   // Check that folder specified
   if (name == null)
     // Folder is required
     return FormValidation.error(Messages.PythonInstallation_Name_Required());
   // Check that path does not contains some whitespace chars
   if (StringUtil.hasWhitespace(name))
     // Whitespace are not allowed
     return FormValidation.error(Messages.PythonInstallation_Name_WhitespaceNotAllowed());
   // Seems fine
   return FormValidation.ok();
 }
    public FormValidation doCheckPassword(@QueryParameter final String value) {

      String password = Util.fixEmptyAndTrim(value);
      if (password == null) {
        return FormValidation.error("Please enter password.");
      }

      if (password.indexOf('$') >= 0) {
        // set by variable, can't validate
        return FormValidation.error("Environment variable cannot be used in password.");
      }

      return FormValidation.ok();
    }
Ejemplo n.º 24
0
 public static FormValidation validateURL(final String url) {
   if (StringUtils.trimToNull(url) == null) {
     return FormValidation.warning("Don't forget to include the URL.");
   }
   try {
     final URI uri = new URI(url);
     if (uri.getScheme() == null || uri.getHost() == null) {
       return FormValidation.error("Invalid URL: " + url);
     }
     return FormValidation.ok();
   } catch (final Exception e) {
     return FormValidation.error("URL could not be parsed.");
   }
 }
Ejemplo n.º 25
0
 public FormValidation doCheckPrivateKey(@QueryParameter String value)
     throws IOException, ServletException {
   boolean hasStart = false, hasEnd = false;
   BufferedReader br = new BufferedReader(new StringReader(value));
   String line;
   while ((line = br.readLine()) != null) {
     if (line.equals("-----BEGIN RSA PRIVATE KEY-----")) hasStart = true;
     if (line.equals("-----END RSA PRIVATE KEY-----")) hasEnd = true;
   }
   if (!hasStart) return FormValidation.error("This doesn't look like a private key at all");
   if (!hasEnd)
     return FormValidation.error(
         "The private key is missing the trailing 'END RSA PRIVATE KEY' marker. Copy&paste error?");
   return FormValidation.ok();
 }
Ejemplo n.º 26
0
    public FormValidation doCheckPrivate_key_file_path(@QueryParameter String value) {
      if (value.length() == 0) {
        return FormValidation.error("Please set a path to private key file");
      }
      File f = new File(value);
      if (!f.exists()) {
        return FormValidation.error("File doesn't exists");
      }
      if (!SSHMarker.IsPrivateKeyFileValid(f)) {
        return FormValidation.error("Private key file is not valid");
      }
      path_to_private_key_file = value;

      return FormValidation.ok();
    }
 /*
  * --- Validation methods ---
  */
 public FormValidation doCheckMandatory(@QueryParameter String value) {
   FormValidation returnValue = FormValidation.ok();
   if (StringUtils.isBlank(value)) {
     returnValue = FormValidation.error("Required value.");
   }
   return returnValue;
 }
    public FormValidation doCheckIdleTerminationInMinutes(
        @QueryParameter String idleTerminationInMinutes) {
      if (Strings.isNullOrEmpty(idleTerminationInMinutes)) {
        return FormValidation.error("Must be set");
      } else {
        int number;

        try {
          number = Integer.parseInt(idleTerminationInMinutes);
        } catch (Exception e) {
          return FormValidation.error("Must be a number");
        }

        return FormValidation.ok();
      }
    }
Ejemplo n.º 29
0
 /* Parse a url or return a sensible error */
 public static URL checkEndPoint(String url) throws FormValidation {
   try {
     return new URL(url);
   } catch (MalformedURLException ex) {
     throw FormValidation.error("Endpoint URL is not a valid URL");
   }
 }
    public FormValidation doCheckMemorySize(@QueryParameter String value)
        throws IOException, ServletException {

      if (value.length() == 0)
        return FormValidation.error(Messages.validation_required("Memory Size"));
      return FormValidation.ok();
    }