Validate the parameters.

@param filePath
@param password
@param validity
@param subjectDN
338542
private void validateParameters(String filePath, String password, int validity, String subjectDN, int keySize, String sigAlg) {
        if (!validateFilePath(filePath)) {
            throw new IllegalArgumentException("filePath must be a valid filePath within the file system.");
        }
        if (password == null || password.length() < MINIMUM_PASSWORD_LENGTH) {
            throw new IllegalArgumentException("The password must be at least " +
                                               MINIMUM_PASSWORD_LENGTH +
                                               " characters in length.");
        }
        if (validity < MINIMUM_VALIDITY) {
            throw new IllegalArgumentException("The validity period must be at least " +
                                               MINIMUM_VALIDITY + " days.");
        }

        List<String> validSigAlg = VALID_SIG_ALG;
        if (!validSigAlg.contains(sigAlg)) {
            throw new IllegalArgumentException("The signagure algorithm values include " + VALID_SIG_ALG);
        }

        String type = getKeyFromSigAlg(sigAlg);
        if (type.equals(KEYALG_RSA_TYPE)) {
            List<Integer> validKeySizes = VALID_RSA_KEYSIZE;
            if (!validKeySizes.contains(keySize)) {
                throw new IllegalArgumentException("The key sizes for an RSA key include " + VALID_RSA_KEYSIZE);
            }
        } else {
            List<Integer> validKeySizes = VALID_EC_KEYSIZE;
            if (!validKeySizes.contains(keySize)) {
                throw new IllegalArgumentException("The key sizes for an EC key include " + VALID_EC_KEYSIZE);
            }
        }

        validateSubjectDN(subjectDN);
    }
565890
private static function validateSource($basePath, $sourcePath)
    {
        $urlData = parse_url($sourcePath);
        if (!empty($urlData['scheme'])) {
            return;
        }

        if (!\helpers_File::isFileInsideDirectory($sourcePath, $basePath)) {
            throw new InvalidSourcePathException($basePath, $sourcePath);
        }
    }
60960
@Override
    public boolean validatePassword(String cleartext, String encrypted) {
        // If local account has no password, do not allow login.
        if (encrypted == null) {
            return false;
        } else if (encrypted.startsWith(MD5_PREFIX)) {
            encrypted = encrypted.substring(5);
            return md5Encryptor.checkPassword(cleartext, encrypted);
        } else if (encrypted.startsWith(SHA256_PREFIX)) {
            encrypted = encrypted.substring(8);
            return sha256Encryptor.checkPassword(cleartext, encrypted);
        } else {
            throw new IllegalArgumentException(
                    "This portal password service is only currently capable of validating MD5 and SHA-256 passwords");
        }
    }
249624
public static String verifyReadFile(String filePath){
		if (filePath==null){
			return "The path is null";
		} 

		File dir=new File(filePath);

		return verifyReadFile(dir);			
	}
292760
private boolean doUserPasswordAuthentication(Socket s,
                                                InputStream in,
                                                OutputStream out) 
                                                throws IOException{
     int version = in.read();
     if(version != 1) return false;
     int ulen = in.read();
     if(ulen < 0) return false;
     byte[] user = new byte[ulen];
     in.read(user);
     int plen = in.read();
     if(plen < 0) return false;
     byte[] password = new byte[plen];
     in.read(password);

     if(validator.isUserValid(new String(user), new String(password),s)){
       //System.out.println("user valid");
       out.write(new byte[]{1,0});
     }else{
       //System.out.println("user invalid");
       out.write(new byte[]{1,1});
       return false;
     }

     return true;
   }
519619
@Override
	public boolean validate(final Problems problems, final String compName, final String text) {
		boolean invalid = text.contains(File.separator) || text.contains(File.pathSeparator);
		if (!invalid && Utilities.isWindows()) {
			invalid = text.contains(":");
		}
		final String result = invalid
				? ValidationBundle.getMessage(IllegalCharactersInFileNameValidator.class, "ERR_INVALID_FILE_NAME", compName, text)
				: null; // NOI18N
		if (result != null) {
			problems.add(result);
		}
		return !invalid;
	}
521429
private void validate(File root, Collection<URI> dirs) throws IOException {
    if (dirs == null)
      return;
    for (URI dir : dirs) {
      if (new File(dir.getPath()).getAbsolutePath().equals(
          root.getAbsolutePath())) {
        // we found the corresponding entry
        return;
      }
    }
    throwIOException("Error. Storage directory: " + root
        + " is not in the configured list of storage directories: " + dirs);
  }
1290932
public void validate(String path, String exceptionMessagePrefix) {
    if (!matches(path)) {
      throw new ValidationException(
          String.format(
              "%s: Parameter \"%s\" must be in the form \"%s\"",
              exceptionMessagePrefix, path, this.toString()));
    }
  }
92520
private void verifyFile(String[] args, int startIndex) {
    Path root = null;
    if (args.length <= startIndex) {
      throw new IllegalArgumentException("too few arguments");
    }
    String arg = args[startIndex];
    root = new Path(arg);
    try {
      FileSystem fs = root.getFileSystem(conf);
      // Make sure default uri is the same as root  
      conf.set(FileSystem.FS_DEFAULT_NAME_KEY, fs.getUri().toString());
      FileVerifier fv = new FileVerifier(conf);
      fv.verifyFile(root, System.out);
    } catch (IOException ex) {
      System.err.println("verifyFile: " + ex);
    }
  }
1215767
public void validateWithXmlSchema(String filename, String xmlSchemaPath) throws IOException {
    try (InputStream xmlStream = this.getClass().getResourceAsStream(filename)) {
      if (xmlStream == null) {
        throw new IOException("File not found in classpath: " + filename);
      }
      URL schemaUrl = this.getClass().getResource(xmlSchemaPath);
      if (schemaUrl == null) {
        throw new IOException("XML schema not found in classpath: " + xmlSchemaPath);
      }
      validateInternal(new StreamSource(xmlStream), schemaUrl);
    } catch (Exception e) {
      throw new IOException("Cannot load or parse '" + filename + "'", e);
    }
  }
713012
protected void validate() {
    // make sure that the source uri is set correctly.
    if (mSourceUri == null) {
      throw new BuilderException("Source must be set!");
    }

    // For local resource we require caller to specify statically generated resource id as a path.
    if (UriUtil.isLocalResourceUri(mSourceUri)) {
      if (!mSourceUri.isAbsolute()) {
        throw new BuilderException("Resource URI path must be absolute.");
      }
      if (mSourceUri.getPath().isEmpty()) {
        throw new BuilderException("Resource URI must not be empty");
      }
      try {
        Integer.parseInt(mSourceUri.getPath().substring(1));
      } catch (NumberFormatException ignored) {
        throw new BuilderException("Resource URI path must be a resource id.");
      }
    }

    // For local asset we require caller to specify absolute path of an asset, which will be
    // resolved by AssetManager relative to configured asset folder of an app.
    if (UriUtil.isLocalAssetUri(mSourceUri) && !mSourceUri.isAbsolute()) {
      throw new BuilderException("Asset URI path must be absolute.");
    }
  }
29106
private void maybeRunValidityCheck(String passName, Node externs, Node root) {
    if (validityCheck == null) {
      return;
    }
    try {
      validityCheck.create(compiler).process(externs, root);
      changeVerifier.checkRecordedChanges(passName, jsRoot);
    } catch (Exception e) {
      throw new IllegalStateException("Validity checks failed for pass: " + passName, e);
    }
  }
652002
function(filePath, identifier, name) {
    this.filePath = filePath;
    this.identifier = identifier;
    this.name = name ? name : '';
}
567760
public static void updateFileFromUrl(final String sourceUrl, final String destinationFilePath,
                                         final String username, final String password) throws
        UpdateException {
        updateFileFromUrl(sourceUrl, destinationFilePath, username, password, URLFileUpdater.factory());
    }
157993
private void verifyCert(X500Name subject,
        CertificateExtensions extensions)
        throws CertificateParsingException, IOException {

        // if SubjectName is empty, check for SubjectAlternativeNameExtension
        if (subject.isEmpty()) {
            if (extensions == null) {
                throw new CertificateParsingException("X.509 Certificate is " +
                        "incomplete: subject field is empty, and certificate " +
                        "has no extensions");
            }
            SubjectAlternativeNameExtension subjectAltNameExt = null;
            SubjectAlternativeNameExtension extValue = null;
            GeneralNames names = null;
            try {
                subjectAltNameExt = (SubjectAlternativeNameExtension)
                        extensions.get(SubjectAlternativeNameExtension.NAME);
                names = subjectAltNameExt.get(
                        SubjectAlternativeNameExtension.SUBJECT_NAME);
            } catch (IOException e) {
                throw new CertificateParsingException("X.509 Certificate is " +
                        "incomplete: subject field is empty, and " +
                        "SubjectAlternativeName extension is absent");
            }

            // SubjectAlternativeName extension is empty or not marked critical
            if (names == null || names.isEmpty()) {
                throw new CertificateParsingException("X.509 Certificate is " +
                        "incomplete: subject field is empty, and " +
                        "SubjectAlternativeName extension is empty");
            } else if (subjectAltNameExt.isCritical() == false) {
                throw new CertificateParsingException("X.509 Certificate is " +
                        "incomplete: SubjectAlternativeName extension MUST " +
                        "be marked critical when subject field is empty");
            }
        }
    }
239611
public static void validatePath(String path) throws InvalidPathException {
    boolean invalid = (path == null || path.isEmpty());
    if (!OSUtils.isWindows()) {
      invalid = (invalid || !path.startsWith(AlluxioURI.SEPARATOR));
    }

    if (invalid) {
      throw new InvalidPathException(ExceptionMessage.PATH_INVALID.getMessage(path));
    }
  }
552947
private static Path validatePath(Path path) {
		final URI uri = path.toUri();
		final String scheme = uri.getScheme();
		final String pathPart = uri.getPath();

		// some validity checks
		if (scheme == null) {
			throw new IllegalArgumentException("The scheme (hdfs://, file://, etc) is null. " +
					"Please specify the file system scheme explicitly in the URI.");
		}
		if (pathPart == null) {
			throw new IllegalArgumentException("The path to store the checkpoint data in is null. " +
					"Please specify a directory path for the checkpoint data.");
		}
		if (pathPart.length() == 0 || pathPart.equals("/")) {
			throw new IllegalArgumentException("Cannot use the root directory for checkpoints.");
		}

		return path;
	}