Program: 116677
Project: 116677
Buggy source:
public Set<Cluster> getClusters(int tenantId,String cartridgeType){
  Set<CartridgeTypeContext> cartridgeTypeContextSet=null;
  Set<SubscriptionAliasContext> subscriptionAliasContextSet=null;
  Set<Cluster> clusterSet=null;
  readLock.lock();
  try {
    cartridgeTypeContextSet=tenantIdToCartridgeTypeContextMap.get(tenantId);
    if (cartridgeTypeContextSet != null) {
      Iterator<CartridgeTypeContext> typeCtxIterator=cartridgeTypeContextSet.iterator();
      while (typeCtxIterator.hasNext()) {
        CartridgeTypeContext cartridgeTypeContext=typeCtxIterator.next();
        if (cartridgeType != null) {
          if (cartridgeTypeContext.equals(new CartridgeTypeContext(cartridgeType))) {
            subscriptionAliasContextSet=cartridgeTypeContext.getSubscriptionAliasContextSet();
            if (subscriptionAliasContextSet != null) {
              Iterator<SubscriptionAliasContext> aliasCtxIterator=subscriptionAliasContextSet.iterator();
              clusterSet=new HashSet<Cluster>();
              while (aliasCtxIterator.hasNext()) {
                clusterSet.add(aliasCtxIterator.next().getCluster());
              }
            }
          }
        }
 else {
          subscriptionAliasContextSet=cartridgeTypeContext.getSubscriptionAliasContextSet();
          if (subscriptionAliasContextSet != null) {
            Iterator<SubscriptionAliasContext> aliasCtxIterator=subscriptionAliasContextSet.iterator();
            clusterSet=new HashSet<Cluster>();
            while (aliasCtxIterator.hasNext()) {
              clusterSet.add(aliasCtxIterator.next().getCluster());
            }
          }
        }
      }
    }
  }
  finally {
    readLock.unlock();
  }
  return clusterSet;
}

Fixed version (ground truth):
public Set<Cluster> getClusters(int tenantId,String cartridgeType){
  Set<CartridgeTypeContext> cartridgeTypeContextSet=null;
  Set<SubscriptionAliasContext> subscriptionAliasContextSet=null;
  Set<Cluster> clusterSet=null;
  readLock.lock();
  try {
    cartridgeTypeContextSet=tenantIdToCartridgeTypeContextMap.get(tenantId);
    if (cartridgeTypeContextSet != null) {
      Iterator<CartridgeTypeContext> typeCtxIterator=cartridgeTypeContextSet.iterator();
      while (typeCtxIterator.hasNext()) {
        CartridgeTypeContext cartridgeTypeContext=typeCtxIterator.next();
        if (cartridgeType != null) {
          if (cartridgeTypeContext.equals(new CartridgeTypeContext(cartridgeType))) {
            subscriptionAliasContextSet=cartridgeTypeContext.getSubscriptionAliasContextSet();
            if (subscriptionAliasContextSet != null) {
              Iterator<SubscriptionAliasContext> aliasCtxIterator=subscriptionAliasContextSet.iterator();
              clusterSet=new HashSet<Cluster>();
              while (aliasCtxIterator.hasNext()) {
                clusterSet.add(aliasCtxIterator.next().getCluster());
              }
            }
          }
        }
 else {
          subscriptionAliasContextSet=cartridgeTypeContext.getSubscriptionAliasContextSet();
          if (subscriptionAliasContextSet != null) {
            Iterator<SubscriptionAliasContext> aliasCtxIterator=subscriptionAliasContextSet.iterator();
            clusterSet=new HashSet<Cluster>();
            while (aliasCtxIterator.hasNext()) {
              Cluster cluster=aliasCtxIterator.next().getCluster();
              clusterSet.add(cluster);
              if (log.isDebugEnabled()) {
                log.debug("String_Node_Str" + tenantId + "String_Node_Str"+ cartridgeType+ "String_Node_Str"+ cluster.toString());
              }
            }
          }
        }
      }
    }
  }
  finally {
    readLock.unlock();
  }
  return clusterSet;
}