static NameConstraintsExtension mergeNameConstraints(X509Certificate currCert,NameConstraintsExtension prevNC) throws CertPathValidatorException {
  X509CertImpl currCertImpl;
  try {
    currCertImpl=X509CertImpl.toImpl(currCert);
  }
 catch (  CertificateException ce) {
    throw new CertPathValidatorException(ce);
  }
  NameConstraintsExtension newConstraints=currCertImpl.getNameConstraintsExtension();
  if (debug != null) {
    debug.println("prevNC = " + prevNC + ", newNC = "+ String.valueOf(newConstraints));
  }
  if (prevNC == null) {
    if (debug != null) {
      debug.println("mergedNC = " + String.valueOf(newConstraints));
    }
    if (newConstraints == null) {
      return newConstraints;
    }
 else {
      return (NameConstraintsExtension)newConstraints.clone();
    }
  }
 else {
    try {
      prevNC.merge(newConstraints);
    }
 catch (    IOException ioe) {
      throw new CertPathValidatorException(ioe);
    }
    if (debug != null) {
      debug.println("mergedNC = " + prevNC);
    }
    return prevNC;
  }
}

static NameConstraintsExtension mergeNameConstraints ( X509Certificate currCert , NameConstraintsExtension prevNC ) throws CertPathValidatorException { X509CertImpl currCertImpl ; try { currCertImpl = X509CertImpl . toImpl ( currCert ) ; } catch ( CertificateException ce ) { throw new CertPathValidatorException ( ce ) ; } NameConstraintsExtension newConstraints = currCertImpl . getNameConstraintsExtension ( ) ; if ( debug != null ) { debug . println ( "prevNC = " + prevNC + ", newNC = " + String . valueOf ( newConstraints ) ) ; } if ( prevNC == null ) { if ( debug != null ) { debug . println ( "mergedNC = " + String . valueOf ( newConstraints ) ) ; } if ( newConstraints == null ) { return newConstraints ; } else { return ( NameConstraintsExtension ) newConstraints . clone ( ) ; } } else { try { prevNC . merge ( newConstraints ) ; } catch ( IOException ioe ) { throw new CertPathValidatorException ( ioe ) ; } if ( debug != null ) { debug . println ( "mergedNC = " + prevNC ) ; } return prevNC ; } }
helper to fold sets of name constraints together
