コード例 #1
0
 protected static PKIXPolicyNode prepareNextCertB2(
     int i, List[] policyNodes, String id_p, PKIXPolicyNode validPolicyTree) {
   Iterator nodes_i = policyNodes[i].iterator();
   while (nodes_i.hasNext()) {
     PKIXPolicyNode node = (PKIXPolicyNode) nodes_i.next();
     if (node.getValidPolicy().equals(id_p)) {
       PKIXPolicyNode p_node = (PKIXPolicyNode) node.getParent();
       p_node.removeChild(node);
       nodes_i.remove();
       for (int k = (i - 1); k >= 0; k--) {
         List nodes = policyNodes[k];
         for (int l = 0; l < nodes.size(); l++) {
           PKIXPolicyNode node2 = (PKIXPolicyNode) nodes.get(l);
           if (!node2.hasChildren()) {
             validPolicyTree = removePolicyNode(validPolicyTree, policyNodes, node2);
             if (validPolicyTree == null) {
               break;
             }
           }
         }
       }
     }
   }
   return validPolicyTree;
 }
コード例 #2
0
  protected static PKIXPolicyNode removePolicyNode(
      PKIXPolicyNode validPolicyTree, List[] policyNodes, PKIXPolicyNode _node) {
    PKIXPolicyNode _parent = (PKIXPolicyNode) _node.getParent();

    if (validPolicyTree == null) {
      return null;
    }

    if (_parent == null) {
      for (int j = 0; j < policyNodes.length; j++) {
        policyNodes[j] = new ArrayList();
      }

      return null;
    } else {
      _parent.removeChild(_node);
      removePolicyNodeRecurse(policyNodes, _node);

      return validPolicyTree;
    }
  }