Program: 116659
Project: 116659
Buggy source:
private TopologyMessageProcessorChain createEventProcessorChain(){
  TopologyMessageProcessorChain processorChain=new TopologyMessageProcessorChain();
  processorChain.addEventListener(new CompleteTopologyEventListener(){
    @Override protected void onEvent(    Event event){
      log.info("String_Node_Str" + event.getClass() + "String_Node_Str");
      try {
        TopologyManager.acquireReadLock();
        for (        Service service : TopologyManager.getTopology().getServices()) {
          for (          Cluster cluster : service.getClusters()) {
            Set<CartridgeSubscription> cartridgeSubscriptions=getCartridgeSubscription(cluster.getClusterId());
            if (cartridgeSubscriptions != null) {
              for (              CartridgeSubscription cartridgeSubscription : cartridgeSubscriptions) {
                TopologyClusterInformationModel.getInstance().addCluster(cartridgeSubscription.getSubscriber().getTenantId(),cartridgeSubscription.getType(),cartridgeSubscription.getAlias(),cluster);
              }
            }
          }
        }
      }
  finally {
        TopologyManager.releaseReadLock();
      }
    }
  }
);
  processorChain.addEventListener(new ClusterCreatedEventListener(){
    @Override protected void onEvent(    Event event){
      log.info("String_Node_Str" + event.getClass() + "String_Node_Str");
      ClusterCreatedEvent clustercreatedEvent=(ClusterCreatedEvent)event;
      Set<CartridgeSubscription> cartridgeSubscriptions=getCartridgeSubscription(clustercreatedEvent.getClusterId());
      if (cartridgeSubscriptions != null) {
        Cluster cluster;
        TopologyManager.acquireReadLock();
        try {
          for (          CartridgeSubscription cartridgeSubscription : cartridgeSubscriptions) {
            cluster=TopologyManager.getTopology().getService(cartridgeSubscription.getType()).getCluster(cartridgeSubscription.getClusterDomain());
            TopologyClusterInformationModel.getInstance().addCluster(cartridgeSubscription.getSubscriber().getTenantId(),cartridgeSubscription.getType(),cartridgeSubscription.getAlias(),cluster);
          }
        }
  finally {
          TopologyManager.releaseReadLock();
        }
      }
    }
  }
);
  processorChain.addEventListener(new InstanceSpawnedEventListener(){
    @Override protected void onEvent(    Event event){
      log.info("String_Node_Str" + event.getClass() + "String_Node_Str");
      InstanceSpawnedEvent instanceSpawnedEvent=(InstanceSpawnedEvent)event;
      String clusterDomain=instanceSpawnedEvent.getClusterId();
      Set<CartridgeSubscription> cartridgeSubscriptions=getCartridgeSubscription(clusterDomain);
      if (cartridgeSubscriptions != null) {
        Cluster cluster;
        TopologyManager.acquireReadLock();
        try {
          for (          CartridgeSubscription cartridgeSubscription : cartridgeSubscriptions) {
            cluster=TopologyManager.getTopology().getService(cartridgeSubscription.getType()).getCluster(cartridgeSubscription.getClusterDomain());
            TopologyClusterInformationModel.getInstance().addCluster(cartridgeSubscription.getSubscriber().getTenantId(),cartridgeSubscription.getType(),cartridgeSubscription.getAlias(),cluster);
          }
        }
  finally {
          TopologyManager.releaseReadLock();
        }
      }
    }
  }
);
  processorChain.addEventListener(new MemberStartedEventListener(){
    @Override protected void onEvent(    Event event){
      log.info("String_Node_Str" + event.getClass() + "String_Node_Str");
      MemberStartedEvent memberStartedEvent=(MemberStartedEvent)event;
      String clusterDomain=memberStartedEvent.getClusterId();
      Set<CartridgeSubscription> cartridgeSubscriptions=getCartridgeSubscription(clusterDomain);
      if (cartridgeSubscriptions != null) {
        Cluster cluster;
        TopologyManager.acquireReadLock();
        try {
          for (          CartridgeSubscription cartridgeSubscription : cartridgeSubscriptions) {
            cluster=TopologyManager.getTopology().getService(cartridgeSubscription.getType()).getCluster(cartridgeSubscription.getClusterDomain());
            TopologyClusterInformationModel.getInstance().addCluster(cartridgeSubscription.getSubscriber().getTenantId(),cartridgeSubscription.getType(),cartridgeSubscription.getAlias(),cluster);
          }
        }
  finally {
          TopologyManager.releaseReadLock();
        }
      }
    }
  }
);
  processorChain.addEventListener(new MemberActivatedEventListener(){
    @Override protected void onEvent(    Event event){
      log.info("String_Node_Str" + event.getClass() + "String_Node_Str");
      MemberActivatedEvent memberActivatedEvent=(MemberActivatedEvent)event;
      String clusterDomain=memberActivatedEvent.getClusterId();
      Set<CartridgeSubscription> cartridgeSubscriptions=getCartridgeSubscription(clusterDomain);
      if (cartridgeSubscriptions != null) {
        Cluster cluster;
        TopologyManager.acquireReadLock();
        try {
          for (          CartridgeSubscription cartridgeSubscription : cartridgeSubscriptions) {
            cluster=TopologyManager.getTopology().getService(cartridgeSubscription.getType()).getCluster(cartridgeSubscription.getClusterDomain());
            TopologyClusterInformationModel.getInstance().addCluster(cartridgeSubscription.getSubscriber().getTenantId(),cartridgeSubscription.getType(),cartridgeSubscription.getAlias(),cluster);
          }
        }
  finally {
          TopologyManager.releaseReadLock();
        }
      }
    }
  }
);
  processorChain.addEventListener(new MemberSuspendedEventListener(){
    @Override protected void onEvent(    Event event){
      log.info("String_Node_Str" + event.getClass() + "String_Node_Str");
      MemberSuspendedEvent memberSuspendedEvent=(MemberSuspendedEvent)event;
      String clusterDomain=memberSuspendedEvent.getClusterId();
      Set<CartridgeSubscription> cartridgeSubscriptions=getCartridgeSubscription(clusterDomain);
      if (cartridgeSubscriptions != null) {
        Cluster cluster;
        TopologyManager.acquireReadLock();
        try {
          for (          CartridgeSubscription cartridgeSubscription : cartridgeSubscriptions) {
            cluster=TopologyManager.getTopology().getService(cartridgeSubscription.getType()).getCluster(cartridgeSubscription.getClusterDomain());
            TopologyClusterInformationModel.getInstance().addCluster(cartridgeSubscription.getSubscriber().getTenantId(),cartridgeSubscription.getType(),cartridgeSubscription.getAlias(),cluster);
          }
        }
  finally {
          TopologyManager.releaseReadLock();
        }
      }
    }
  }
);
  processorChain.addEventListener(new MemberTerminatedEventListener(){
    @Override protected void onEvent(    Event event){
      log.info("String_Node_Str" + event.getClass() + "String_Node_Str");
      MemberTerminatedEvent memberTerminatedEvent=(MemberTerminatedEvent)event;
      String clusterDomain=memberTerminatedEvent.getClusterId();
      Set<CartridgeSubscription> cartridgeSubscriptions=getCartridgeSubscription(clusterDomain);
      if (cartridgeSubscriptions != null) {
        Cluster cluster;
        TopologyManager.acquireReadLock();
        try {
          for (          CartridgeSubscription cartridgeSubscription : cartridgeSubscriptions) {
            cluster=TopologyManager.getTopology().getService(cartridgeSubscription.getType()).getCluster(cartridgeSubscription.getClusterDomain());
            Member terminatedMember=cluster.getMember(memberTerminatedEvent.getMemberId());
            cluster.removeMember(terminatedMember);
            if (log.isDebugEnabled()) {
              log.debug("String_Node_Str" + memberTerminatedEvent.getMemberId() + "String_Node_Str");
            }
            TopologyClusterInformationModel.getInstance().addCluster(cartridgeSubscription.getSubscriber().getTenantId(),cartridgeSubscription.getType(),cartridgeSubscription.getAlias(),cluster);
          }
        }
  finally {
          TopologyManager.releaseReadLock();
        }
      }
    }
  }
);
  return processorChain;
}

Fixed version (ground truth):
private TopologyMessageProcessorChain createEventProcessorChain(){
  TopologyMessageProcessorChain processorChain=new TopologyMessageProcessorChain();
  processorChain.addEventListener(new CompleteTopologyEventListener(){
    @Override protected void onEvent(    Event event){
      log.info("String_Node_Str" + event.getClass() + "String_Node_Str");
      try {
        TopologyManager.acquireReadLock();
        for (        Service service : TopologyManager.getTopology().getServices()) {
          for (          Cluster cluster : service.getClusters()) {
            Set<CartridgeSubscription> cartridgeSubscriptions=getCartridgeSubscription(cluster.getClusterId());
            if (cartridgeSubscriptions != null) {
              for (              CartridgeSubscription cartridgeSubscription : cartridgeSubscriptions) {
                TopologyClusterInformationModel.getInstance().addCluster(cartridgeSubscription.getSubscriber().getTenantId(),cartridgeSubscription.getType(),cartridgeSubscription.getAlias(),cluster);
              }
            }
          }
        }
      }
  finally {
        TopologyManager.releaseReadLock();
      }
    }
  }
);
  processorChain.addEventListener(new ClusterCreatedEventListener(){
    @Override protected void onEvent(    Event event){
      log.info("String_Node_Str" + event.getClass() + "String_Node_Str");
      ClusterCreatedEvent clustercreatedEvent=(ClusterCreatedEvent)event;
      Set<CartridgeSubscription> cartridgeSubscriptions=getCartridgeSubscription(clustercreatedEvent.getClusterId());
      if (cartridgeSubscriptions != null) {
        Cluster cluster;
        TopologyManager.acquireReadLock();
        try {
          for (          CartridgeSubscription cartridgeSubscription : cartridgeSubscriptions) {
            cluster=TopologyManager.getTopology().getService(cartridgeSubscription.getType()).getCluster(cartridgeSubscription.getClusterDomain());
            TopologyClusterInformationModel.getInstance().addCluster(cartridgeSubscription.getSubscriber().getTenantId(),cartridgeSubscription.getType(),cartridgeSubscription.getAlias(),cluster);
          }
        }
  finally {
          TopologyManager.releaseReadLock();
        }
      }
    }
  }
);
  processorChain.addEventListener(new InstanceSpawnedEventListener(){
    @Override protected void onEvent(    Event event){
      log.info("String_Node_Str" + event.getClass() + "String_Node_Str");
      InstanceSpawnedEvent instanceSpawnedEvent=(InstanceSpawnedEvent)event;
      String clusterDomain=instanceSpawnedEvent.getClusterId();
      Set<CartridgeSubscription> cartridgeSubscriptions=getCartridgeSubscription(clusterDomain);
      if (cartridgeSubscriptions != null) {
        Cluster cluster;
        TopologyManager.acquireReadLock();
        try {
          for (          CartridgeSubscription cartridgeSubscription : cartridgeSubscriptions) {
            cluster=TopologyManager.getTopology().getService(cartridgeSubscription.getType()).getCluster(cartridgeSubscription.getClusterDomain());
            TopologyClusterInformationModel.getInstance().addCluster(cartridgeSubscription.getSubscriber().getTenantId(),cartridgeSubscription.getType(),cartridgeSubscription.getAlias(),cluster);
          }
        }
  finally {
          TopologyManager.releaseReadLock();
        }
      }
    }
  }
);
  processorChain.addEventListener(new MemberStartedEventListener(){
    @Override protected void onEvent(    Event event){
      log.info("String_Node_Str" + event.getClass() + "String_Node_Str");
      MemberStartedEvent memberStartedEvent=(MemberStartedEvent)event;
      String clusterDomain=memberStartedEvent.getClusterId();
      Set<CartridgeSubscription> cartridgeSubscriptions=getCartridgeSubscription(clusterDomain);
      if (cartridgeSubscriptions != null) {
        Cluster cluster;
        TopologyManager.acquireReadLock();
        try {
          for (          CartridgeSubscription cartridgeSubscription : cartridgeSubscriptions) {
            cluster=TopologyManager.getTopology().getService(cartridgeSubscription.getType()).getCluster(cartridgeSubscription.getClusterDomain());
            TopologyClusterInformationModel.getInstance().addCluster(cartridgeSubscription.getSubscriber().getTenantId(),cartridgeSubscription.getType(),cartridgeSubscription.getAlias(),cluster);
          }
        }
  finally {
          TopologyManager.releaseReadLock();
        }
      }
    }
  }
);
  processorChain.addEventListener(new MemberActivatedEventListener(){
    @Override protected void onEvent(    Event event){
      log.info("String_Node_Str" + event.getClass() + "String_Node_Str");
      MemberActivatedEvent memberActivatedEvent=(MemberActivatedEvent)event;
      String clusterDomain=memberActivatedEvent.getClusterId();
      Set<CartridgeSubscription> cartridgeSubscriptions=getCartridgeSubscription(clusterDomain);
      if (cartridgeSubscriptions != null) {
        Cluster cluster;
        TopologyManager.acquireReadLock();
        try {
          for (          CartridgeSubscription cartridgeSubscription : cartridgeSubscriptions) {
            cluster=TopologyManager.getTopology().getService(cartridgeSubscription.getType()).getCluster(cartridgeSubscription.getClusterDomain());
            TopologyClusterInformationModel.getInstance().addCluster(cartridgeSubscription.getSubscriber().getTenantId(),cartridgeSubscription.getType(),cartridgeSubscription.getAlias(),cluster);
          }
        }
  finally {
          TopologyManager.releaseReadLock();
        }
      }
    }
  }
);
  processorChain.addEventListener(new MemberSuspendedEventListener(){
    @Override protected void onEvent(    Event event){
      log.info("String_Node_Str" + event.getClass() + "String_Node_Str");
      MemberSuspendedEvent memberSuspendedEvent=(MemberSuspendedEvent)event;
      String clusterDomain=memberSuspendedEvent.getClusterId();
      Set<CartridgeSubscription> cartridgeSubscriptions=getCartridgeSubscription(clusterDomain);
      if (cartridgeSubscriptions != null) {
        Cluster cluster;
        TopologyManager.acquireReadLock();
        try {
          for (          CartridgeSubscription cartridgeSubscription : cartridgeSubscriptions) {
            cluster=TopologyManager.getTopology().getService(cartridgeSubscription.getType()).getCluster(cartridgeSubscription.getClusterDomain());
            TopologyClusterInformationModel.getInstance().addCluster(cartridgeSubscription.getSubscriber().getTenantId(),cartridgeSubscription.getType(),cartridgeSubscription.getAlias(),cluster);
          }
        }
  finally {
          TopologyManager.releaseReadLock();
        }
      }
    }
  }
);
  processorChain.addEventListener(new MemberTerminatedEventListener(){
    @Override protected void onEvent(    Event event){
      log.info("String_Node_Str" + event.getClass() + "String_Node_Str");
      MemberTerminatedEvent memberTerminatedEvent=(MemberTerminatedEvent)event;
      String clusterDomain=memberTerminatedEvent.getClusterId();
      Set<CartridgeSubscription> cartridgeSubscriptions=getCartridgeSubscription(clusterDomain);
      if (cartridgeSubscriptions != null) {
        Cluster cluster;
        TopologyManager.acquireReadLock();
        try {
          for (          CartridgeSubscription cartridgeSubscription : cartridgeSubscriptions) {
            cluster=TopologyManager.getTopology().getService(cartridgeSubscription.getType()).getCluster(cartridgeSubscription.getClusterDomain());
            if (cluster.memberExists(memberTerminatedEvent.getMemberId())) {
              Member terminatedMember=cluster.getMember(memberTerminatedEvent.getMemberId());
              cluster.removeMember(terminatedMember);
              if (log.isDebugEnabled()) {
                log.debug("String_Node_Str" + memberTerminatedEvent.getMemberId() + "String_Node_Str");
              }
            }
            TopologyClusterInformationModel.getInstance().addCluster(cartridgeSubscription.getSubscriber().getTenantId(),cartridgeSubscription.getType(),cartridgeSubscription.getAlias(),cluster);
          }
        }
  finally {
          TopologyManager.releaseReadLock();
        }
      }
    }
  }
);
  return processorChain;
}