}
}
while (! stack.isEmpty());
Extension e = null;
CertificatePolicies policies = null;
List qualifierInfos = null;
if (cert instanceof GnuPKIExtension)
{
e = ((GnuPKIExtension) cert).getExtension(CertificatePolicies.ID);
if (e != null)
policies = (CertificatePolicies) e.getValue();
}
List cp = null;
if (policies != null)
cp = policies.getPolicies();
else
cp = Collections.EMPTY_LIST;
boolean match = false;
if (Configuration.DEBUG)
{
log.fine("nodes are == " + nodes);
log.fine("cert policies are == " + cp);
}
for (Iterator it = nodes.iterator(); it.hasNext();)
{
PolicyNodeImpl parent = (PolicyNodeImpl) it.next();
if (Configuration.DEBUG)
log.fine("adding policies to " + parent);
for (Iterator it2 = cp.iterator(); it2.hasNext();)
{
OID policy = (OID) it2.next();
if (Configuration.DEBUG)
log.fine("trying to add policy == " + policy);
if (policy.toString().equals(ANY_POLICY)
&& params.isAnyPolicyInhibited())
continue;
PolicyNodeImpl child = new PolicyNodeImpl();
child.setValidPolicy(policy.toString());
child.addExpectedPolicy(policy.toString());
if (parent.getExpectedPolicies().contains(policy.toString()))
{
parent.addChild(child);
match = true;
}
else if (parent.getExpectedPolicies().contains(ANY_POLICY))
{
parent.addChild(child);
match = true;
}
else if (ANY_POLICY.equals(policy.toString()))
{
parent.addChild(child);
match = true;
}
if (match && policies != null)
{
List qualifiers = policies.getPolicyQualifierInfos(policy);
if (qualifiers != null)
child.addAllPolicyQualifiers(qualifiers);
}
}
}