code: public void updateState(TrustAnchor anchor, BuilderParams buildParams)
          throws CertificateException, IOException, CertPathValidatorException
      {
          trustAnchor = anchor;
          X509Certificate trustedCert = anchor.getTrustedCert();
          if (trustedCert != null) {
              updateState(trustedCert);
          } else {
              X500Principal caName = anchor.getCA();
              updateState(anchor.getCAPublicKey(), caName);
          }
  
          // The user specified AlgorithmChecker and RevocationChecker may not be
          // able to set the trust anchor until now.
          boolean revCheckerAdded = false;
          for (PKIXCertPathChecker checker : userCheckers) {
              if (checker instanceof AlgorithmChecker) {
                  ((AlgorithmChecker)checker).trySetTrustAnchor(anchor);
              } else if (checker instanceof PKIXRevocationChecker) {
                  if (revCheckerAdded) {
                      throw new CertPathValidatorException(
                          "Only one PKIXRevocationChecker can be specified");
                  }
                  // if it's our own, initialize it
                  if (checker instanceof RevocationChecker) {
                      ((RevocationChecker)checker).init(anchor, buildParams);
                  }
                  ((PKIXRevocationChecker)checker).init(false);
                  revCheckerAdded = true;
              }
          }
  
          // only create a RevocationChecker if revocation is enabled and
          // a PKIXRevocationChecker has not already been added
          if (buildParams.revocationEnabled() && !revCheckerAdded) {
              revChecker = new RevocationChecker(anchor, buildParams);
              revChecker.init(false);
          }
  
          init = false;
      }
docs: Update the state with the specified trust anchor.
  
  @param anchor the most-trusted CA
  @param buildParams builder parameters