@Override @SuppressWarnings("unchecked") // Safe casts assuming clone() works correctly public Object clone() { try { ReverseState clonedState = (ReverseState) super.clone(); /* clone checkers, if cloneable */ clonedState.userCheckers = (ArrayList<PKIXCertPathChecker>)userCheckers.clone(); ListIterator<PKIXCertPathChecker> li = clonedState.userCheckers.listIterator(); while (li.hasNext()) { PKIXCertPathChecker checker = li.next(); if (checker instanceof Cloneable) { li.set((PKIXCertPathChecker)checker.clone()); } } /* make copy of name constraints */ if (nc != null) { clonedState.nc = (NameConstraintsExtension) nc.clone(); } /* make copy of policy tree */ if (rootNode != null) { clonedState.rootNode = rootNode.copyTree(); } return clonedState; } catch (CloneNotSupportedException e) { throw new InternalError(e.toString(), e); } }
public Object clone() { try { ReverseState clonedState = (ReverseState) super.clone(); /* clone checkers, if cloneable */ clonedState.userCheckers = (ArrayList<PKIXCertPathChecker>)userCheckers.clone(); ListIterator<PKIXCertPathChecker> li = clonedState.userCheckers.listIterator(); while (li.hasNext()) { PKIXCertPathChecker checker = li.next(); if (checker instanceof Cloneable) { li.set((PKIXCertPathChecker)checker.clone()); } } /* make copy of name constraints */ if (nc != null) { clonedState.nc = (NameConstraintsExtension) nc.clone(); } /* make copy of policy tree */ if (rootNode != null) { clonedState.rootNode = rootNode.copyTree(); } return clonedState; } catch (CloneNotSupportedException e) { throw new InternalError(e.toString()); } }
/** * Helper to fold sets of name constraints together */ 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); debug.println("newNC = " + String.valueOf(newConstraints)); } // if there are no previous name constraints, we just return the // new name constraints. if (prevNC == null) { if (debug != null) { debug.println("mergedNC = " + String.valueOf(newConstraints)); } if (newConstraints == null) { return newConstraints; } else { // Make sure we do a clone here, because we're probably // going to modify this object later and we don't want to // be sharing it with a Certificate object! return (NameConstraintsExtension)newConstraints.clone(); } } else { try { // after merge, prevNC should contain the merged constraints 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 */ 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 there are no previous name constraints, we just return the // new name constraints. if (prevNC == null) { if (debug != null) { debug.println("mergedNC = " + String.valueOf(newConstraints)); } if (newConstraints == null) { return newConstraints; } else { // Make sure we do a clone here, because we're probably // going to modify this object later and we don't want to // be sharing it with a Certificate object! return (NameConstraintsExtension)newConstraints.clone(); } } else { try { // after merge, prevNC should contain the merged constraints 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 */ 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); debug.println("newNC = " + String.valueOf(newConstraints)); } // if there are no previous name constraints, we just return the // new name constraints. if (prevNC == null) { if (debug != null) { debug.println("mergedNC = " + String.valueOf(newConstraints)); } if (newConstraints == null) { return newConstraints; } else { // Make sure we do a clone here, because we're probably // going to modify this object later and we don't want to // be sharing it with a Certificate object! return (NameConstraintsExtension) newConstraints.clone(); } } else { try { // after merge, prevNC should contain the merged constraints prevNC.merge(newConstraints); } catch (IOException ioe) { throw new CertPathValidatorException(ioe); } if (debug != null) { debug.println("mergedNC = " + prevNC); } return prevNC; } }