nus-yam/ex-repair huggingface dataset:
Program: 116726
Project: 116726
Buggy source:
private LoadAverage findLoadAverage(String memberId){
  Member member=findMember(memberId);
  if (null == member) {
    if (log.isErrorEnabled()) {
      log.error(String.format("String_Node_Str",memberId));
    }
    return null;
  }
  String clusterId=member.getClusterId();
  AutoscalerContext asCtx=AutoscalerContext.getInstance();
  AbstractMonitor monitor;
  if (asCtx.moniterExist(clusterId)) {
    monitor=asCtx.getMonitor(clusterId);
  }
 else   if (asCtx.lbMoniterExist(clusterId)) {
    monitor=asCtx.getLBMonitor(clusterId);
  }
 else {
    if (log.isDebugEnabled()) {
      log.debug(String.format("String_Node_Str",clusterId));
    }
    return null;
  }
  String networkPartitionId=findNetworkPartitionId(memberId);
  MemberStatsContext memberStatsContext=monitor.getNetworkPartitionCtxt(networkPartitionId).getPartitionCtxt(member.getPartitionId()).getMemberStatsContext(memberId);
  if (null == memberStatsContext) {
    if (log.isDebugEnabled()) {
      log.debug(String.format("String_Node_Str",memberId));
    }
    return null;
  }
 else   if (!member.isActive()) {
    if (log.isDebugEnabled()) {
      log.debug(String.format("String_Node_Str" + "String_Node_Str",memberId));
    }
    return null;
  }
  LoadAverage loadAverage=memberStatsContext.getLoadAverage();
  return loadAverage;
}

Fixed version (ground truth):
private LoadAverage findLoadAverage(String memberId){
  Member member=findMember(memberId);
  if (null == member) {
    if (log.isDebugEnabled()) {
      log.debug(String.format("String_Node_Str",memberId));
    }
    return null;
  }
  String clusterId=member.getClusterId();
  AutoscalerContext asCtx=AutoscalerContext.getInstance();
  AbstractMonitor monitor;
  if (asCtx.moniterExist(clusterId)) {
    monitor=asCtx.getMonitor(clusterId);
  }
 else   if (asCtx.lbMoniterExist(clusterId)) {
    monitor=asCtx.getLBMonitor(clusterId);
  }
 else {
    if (log.isDebugEnabled()) {
      log.debug(String.format("String_Node_Str",clusterId));
    }
    return null;
  }
  String networkPartitionId=findNetworkPartitionId(memberId);
  MemberStatsContext memberStatsContext=monitor.getNetworkPartitionCtxt(networkPartitionId).getPartitionCtxt(member.getPartitionId()).getMemberStatsContext(memberId);
  if (null == memberStatsContext) {
    if (log.isDebugEnabled()) {
      log.debug(String.format("String_Node_Str",memberId));
    }
    return null;
  }
 else   if (!member.isActive()) {
    if (log.isDebugEnabled()) {
      log.debug(String.format("String_Node_Str" + "String_Node_Str",memberId));
    }
    return null;
  }
  LoadAverage loadAverage=memberStatsContext.getLoadAverage();
  return loadAverage;
}
Program: 116727
Project: 116727
Buggy source:
@Override public void run(){
  while (!terminated) {
    try {
      try {
        Thread.sleep(statsPublisherInterval);
      }
 catch (      InterruptedException ignore) {
      }
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str");
      }
      if (inFlightRequestPublisher.isEnabled()) {
        try {
          TopologyManager.acquireReadLock();
          int requestCount;
          for (          Service service : TopologyManager.getTopology().getServices()) {
            for (            Cluster cluster : service.getClusters()) {
              if (!cluster.isLbCluster()) {
                requestCount=statsReader.getInFlightRequestCount(cluster.getClusterId());
                inFlightRequestPublisher.publish(cluster.getClusterId(),networkPartitionId,requestCount);
                if (log.isDebugEnabled()) {
                  log.debug(String.format("String_Node_Str",cluster.getClusterId(),networkPartitionId,requestCount));
                }
              }
 else {
                if (log.isWarnEnabled()) {
                  log.warn(String.format("String_Node_Str",cluster.getClusterId()));
                }
              }
            }
          }
        }
  finally {
          TopologyManager.releaseReadLock();
        }
      }
 else       if (log.isWarnEnabled()) {
        log.warn("String_Node_Str");
      }
    }
 catch (    Exception e) {
      if (log.isErrorEnabled()) {
        log.error("String_Node_Str",e);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (!terminated) {
    try {
      try {
        Thread.sleep(statsPublisherInterval);
      }
 catch (      InterruptedException ignore) {
      }
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str");
      }
      if (inFlightRequestPublisher.isEnabled()) {
        try {
          TopologyManager.acquireReadLock();
          int requestCount;
          for (          Service service : TopologyManager.getTopology().getServices()) {
            for (            Cluster cluster : service.getClusters()) {
              if (!cluster.isLbCluster()) {
                requestCount=statsReader.getInFlightRequestCountOfSlidingWindow(cluster.getClusterId());
                inFlightRequestPublisher.publish(cluster.getClusterId(),networkPartitionId,requestCount);
                if (log.isDebugEnabled()) {
                  log.debug(String.format("String_Node_Str",cluster.getClusterId(),networkPartitionId,requestCount));
                }
              }
 else {
                if (log.isWarnEnabled()) {
                  log.warn(String.format("String_Node_Str",cluster.getClusterId()));
                }
              }
            }
          }
        }
  finally {
          TopologyManager.releaseReadLock();
        }
      }
 else       if (log.isWarnEnabled()) {
        log.warn("String_Node_Str");
      }
    }
 catch (    Exception e) {
      if (log.isErrorEnabled()) {
        log.error("String_Node_Str",e);
      }
    }
  }
}
Program: 116728
Project: 116728
Buggy source:
private void incrementInFlightRequestCount(MessageContext messageContext){
  try {
    String clusterId=(String)messageContext.getProperty(Constants.CLUSTER_ID);
    if (StringUtils.isBlank(clusterId)) {
      throw new RuntimeException("String_Node_Str");
    }
    LoadBalancerStatisticsCollector.getInstance().incrementInFlightRequestCount(clusterId);
  }
 catch (  Exception e) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
private void incrementInFlightRequestCount(MessageContext messageContext){
  try {
    String clusterId=(String)messageContext.getProperty(Constants.CLUSTER_ID);
    if (StringUtils.isBlank(clusterId)) {
      throw new RuntimeException("String_Node_Str");
    }
    LoadBalancerStatisticsCollector.getInstance().addAnInFlightRequest(clusterId);
  }
 catch (  Exception e) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str",e);
    }
  }
}
Program: 116729
Project: 116729
Buggy source:
public boolean mediate(MessageContext messageContext){
  try {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str");
    }
    String clusterId=(String)messageContext.getProperty(Constants.CLUSTER_ID);
    if (StringUtils.isBlank(clusterId)) {
      throw new RuntimeException("String_Node_Str");
    }
    LoadBalancerStatisticsCollector.getInstance().decrementInFlightRequestCount(clusterId);
  }
 catch (  Exception e) {
    if (log.isErrorEnabled()) {
      log.error("String_Node_Str",e);
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean mediate(MessageContext messageContext){
  try {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str");
    }
    String clusterId=(String)messageContext.getProperty(Constants.CLUSTER_ID);
    if (StringUtils.isBlank(clusterId)) {
      throw new RuntimeException("String_Node_Str");
    }
    LoadBalancerStatisticsCollector.getInstance().removeAnInFlightRequest(clusterId);
  }
 catch (  Exception e) {
    if (log.isErrorEnabled()) {
      log.error("String_Node_Str",e);
    }
  }
  return true;
}
Program: 116730
Project: 116730
Buggy source:
private LoadBalancerStatisticsCollector(){
  inFlightRequestCountMap=new ConcurrentHashMap<String,Integer>();
}

Fixed version (ground truth):
private LoadBalancerStatisticsCollector(){
  inFlightRequestToDateListMap=new ConcurrentHashMap<String,Vector<Date>>();
}
Program: 116731
Project: 116731
Buggy source:
public void undeployService(String type) throws ADCException {
  DataInsertionAndRetrievalManager dataInsertionAndRetrievalManager=new DataInsertionAndRetrievalManager();
  Collection<CartridgeSubscription> cartridgeSubscriptions=dataInsertionAndRetrievalManager.getCartridgeSubscriptions(type);
  if (cartridgeSubscriptions != null && !cartridgeSubscriptions.isEmpty()) {
    String errorMsg="String_Node_Str";
    log.error(errorMsg);
    throw new ADCException(errorMsg);
  }
  Service service;
  try {
    service=dataInsertionAndRetrievalManager.getService(type);
  }
 catch (  PersistenceManagerException e) {
    String errorMsg="String_Node_Str";
    log.error(errorMsg,e);
    throw new ADCException(errorMsg,e);
  }
  if (service == null) {
    String errorMsg="String_Node_Str" + type;
    log.error(errorMsg);
    throw new ADCException(errorMsg);
  }
  service.undeploy();
  try {
    dataInsertionAndRetrievalManager.removeService(type);
  }
 catch (  PersistenceManagerException e) {
    String errorMsg="String_Node_Str";
    log.error(errorMsg,e);
    throw new ADCException(errorMsg,e);
  }
}

Fixed version (ground truth):
public void undeployService(String type) throws ADCException {
  DataInsertionAndRetrievalManager dataInsertionAndRetrievalManager=new DataInsertionAndRetrievalManager();
  Collection<CartridgeSubscription> cartridgeSubscriptions=dataInsertionAndRetrievalManager.getCartridgeSubscriptions(type);
  if (cartridgeSubscriptions != null) {
    if (!cartridgeSubscriptions.isEmpty()) {
      String errorMsg="String_Node_Str";
      log.error(errorMsg);
      throw new ADCException(errorMsg);
    }
  }
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + type + "String_Node_Str");
  }
  Service service;
  try {
    service=dataInsertionAndRetrievalManager.getService(type);
  }
 catch (  PersistenceManagerException e) {
    String errorMsg="String_Node_Str";
    log.error(errorMsg,e);
    throw new ADCException(errorMsg,e);
  }
  if (service == null) {
    String errorMsg="String_Node_Str" + type;
    log.error(errorMsg);
    throw new ADCException(errorMsg);
  }
  service.undeploy();
  try {
    dataInsertionAndRetrievalManager.removeService(type);
  }
 catch (  PersistenceManagerException e) {
    String errorMsg="String_Node_Str";
    log.error(errorMsg,e);
    throw new ADCException(errorMsg,e);
  }
}
Program: 116732
Project: 116732
Buggy source:
public MemberStatsContext getMemberStatsContext(String memberId){
  return memberStatsContexts.get(networkPartitionId);
}

Fixed version (ground truth):
public MemberStatsContext getMemberStatsContext(String memberId){
  return memberStatsContexts.get(memberId);
}
Program: 116733
Project: 116733
Buggy source:
public static FactHandle evaluateScaleCheck(StatefulKnowledgeSession ksession,FactHandle handle,Object obj){
  if (handle == null) {
    ksession.setGlobal("String_Node_Str",new RuleTasksDelegator());
    ksession.setGlobal("String_Node_Str",log);
    handle=ksession.insert(obj);
  }
 else {
    ksession.update(handle,obj);
  }
  ksession.fireAllRules();
  if (log.isDebugEnabled()) {
    log.debug(String.format("String_Node_Str",obj));
  }
  return handle;
}

Fixed version (ground truth):
public static FactHandle evaluateScaleCheck(StatefulKnowledgeSession ksession,FactHandle handle,Object obj){
  if (handle == null) {
    ksession.setGlobal("String_Node_Str",new RuleTasksDelegator());
    handle=ksession.insert(obj);
  }
 else {
    ksession.update(handle,obj);
  }
  ksession.fireAllRules();
  if (log.isDebugEnabled()) {
    log.debug(String.format("String_Node_Str",obj));
  }
  return handle;
}
Program: 116734
Project: 116734
Buggy source:
public void addEventListener(EventListener eventListener){
  if (eventListener instanceof ArtifactUpdateEventListener) {
    artifactUpdateMessageProcessor.addEventListener(eventListener);
  }
 else   if (eventListener instanceof InstanceCleanupMemberEventListener) {
    artifactUpdateMessageProcessor.addEventListener(eventListener);
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
public void addEventListener(EventListener eventListener){
  if (eventListener instanceof ArtifactUpdateEventListener) {
    artifactUpdateMessageProcessor.addEventListener(eventListener);
  }
 else   if (eventListener instanceof InstanceCleanupMemberEventListener) {
    artifactUpdateMessageProcessor.addEventListener(eventListener);
  }
 else   if (eventListener instanceof InstanceCleanupClusterEventListener) {
    artifactUpdateMessageProcessor.addEventListener(eventListener);
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
}
Program: 116736
Project: 116736
Buggy source:
public void persistTopology(Topology topology) throws RegistryException {
  try {
    registryService.beginTransaction();
    Resource nodeResource=registryService.newResource();
    nodeResource.setContent(Serializer.serializeToByteArray(topology));
    registryService.put(CloudControllerConstants.CLOUD_CONTROLLER_RESOURCE + CloudControllerConstants.TOPOLOGY_RESOURCE,nodeResource);
    registryService.commitTransaction();
  }
 catch (  Exception e) {
    String msg="String_Node_Str";
    registryService.rollbackTransaction();
    log.error(msg,e);
    throw new CloudControllerException(msg,e);
  }
}

Fixed version (ground truth):
public void persistTopology(Topology topology) throws RegistryException {
  try {
    PrivilegedCarbonContext ctx=PrivilegedCarbonContext.getThreadLocalCarbonContext();
    ctx.setTenantId(MultitenantConstants.SUPER_TENANT_ID);
    ctx.setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
    registryService.beginTransaction();
    Resource nodeResource=registryService.newResource();
    nodeResource.setContent(Serializer.serializeToByteArray(topology));
    registryService.put(CloudControllerConstants.CLOUD_CONTROLLER_RESOURCE + CloudControllerConstants.TOPOLOGY_RESOURCE,nodeResource);
    registryService.commitTransaction();
  }
 catch (  Exception e) {
    String msg="String_Node_Str";
    registryService.rollbackTransaction();
    log.error(msg,e);
    throw new CloudControllerException(msg,e);
  }
}
Program: 116737
Project: 116737
Buggy source:
/** 
 * Persist an object in the local registry.
 * @param dataObj object to be persisted.
 */
public void persist(FasterLookUpDataHolder dataObj) throws RegistryException {
  try {
    registryService.beginTransaction();
    Resource nodeResource=registryService.newResource();
    nodeResource.setContent(Serializer.serializeToByteArray(dataObj));
    registryService.put(CloudControllerConstants.CLOUD_CONTROLLER_RESOURCE + CloudControllerConstants.DATA_RESOURCE,nodeResource);
    registryService.commitTransaction();
  }
 catch (  Exception e) {
    String msg="String_Node_Str";
    registryService.rollbackTransaction();
    log.error(msg,e);
    throw new CloudControllerException(msg,e);
  }
}

Fixed version (ground truth):
/** 
 * Persist an object in the local registry.
 * @param dataObj object to be persisted.
 */
public void persist(FasterLookUpDataHolder dataObj) throws RegistryException {
  try {
    PrivilegedCarbonContext ctx=PrivilegedCarbonContext.getThreadLocalCarbonContext();
    ctx.setTenantId(MultitenantConstants.SUPER_TENANT_ID);
    ctx.setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
    registryService.beginTransaction();
    Resource nodeResource=registryService.newResource();
    nodeResource.setContent(Serializer.serializeToByteArray(dataObj));
    registryService.put(CloudControllerConstants.CLOUD_CONTROLLER_RESOURCE + CloudControllerConstants.DATA_RESOURCE,nodeResource);
    registryService.commitTransaction();
  }
 catch (  Exception e) {
    String msg="String_Node_Str";
    registryService.rollbackTransaction();
    log.error(msg,e);
    throw new CloudControllerException(msg,e);
  }
}
Program: 116738
Project: 116738
Buggy source:
public void removeSubscription(String clusterId){
  Set<CartridgeSubscription> existingSubscriptions=clusterIdToCartridgeSubscription.get(clusterId);
  if (existingSubscriptions != null && !existingSubscriptions.isEmpty()) {
    Iterator<CartridgeSubscription> iterator=existingSubscriptions.iterator();
    while (iterator.hasNext()) {
      CartridgeSubscription cartridgeSubscription=iterator.next();
      if (cartridgeSubscription.getClusterDomain().equals(clusterId)) {
        iterator.remove();
        if (log.isDebugEnabled()) {
          log.debug("String_Node_Str" + clusterId + "String_Node_Str");
        }
        break;
      }
    }
  }
  if (existingSubscriptions != null && existingSubscriptions.isEmpty()) {
    clusterIdToCartridgeSubscription.remove(clusterId);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + clusterId + "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public void removeSubscription(String clusterId,String subscriptionAlias){
  Set<CartridgeSubscription> existingSubscriptions=clusterIdToCartridgeSubscription.get(clusterId);
  if (existingSubscriptions != null && !existingSubscriptions.isEmpty()) {
    Iterator<CartridgeSubscription> iterator=existingSubscriptions.iterator();
    while (iterator.hasNext()) {
      CartridgeSubscription cartridgeSubscription=iterator.next();
      if (cartridgeSubscription.getAlias().equals(subscriptionAlias)) {
        iterator.remove();
        if (log.isDebugEnabled()) {
          log.debug("String_Node_Str" + clusterId + "String_Node_Str");
        }
        break;
      }
    }
  }
  if (existingSubscriptions != null && existingSubscriptions.isEmpty()) {
    clusterIdToCartridgeSubscription.remove(clusterId);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + clusterId + "String_Node_Str");
    }
  }
}
Program: 116739
Project: 116739
Buggy source:
public void removeSubscription(int tenantId,String type,String subscriptionAlias,String clusterId){
  tenantIdToSubscriptionContext.removeSubscriptionContext(tenantId,type,subscriptionAlias);
  clusterIdToSubscription.removeSubscription(clusterId);
}

Fixed version (ground truth):
public void removeSubscription(int tenantId,String type,String subscriptionAlias,String clusterId){
  tenantIdToSubscriptionContext.removeSubscriptionContext(tenantId,type,subscriptionAlias);
  clusterIdToSubscription.removeSubscription(clusterId,subscriptionAlias);
}
Program: 116740
Project: 116740
Buggy source:
protected void activate(ComponentContext context){
  try {
    TopicSubscriber subscriber=new TopicSubscriber(CloudControllerConstants.INSTANCE_TOPIC);
    subscriber.setMessageListener(new InstanceStatusEventMessageListener());
    Thread tsubscriber=new Thread(subscriber);
    tsubscriber.start();
    InstanceStatusEventMessageDelegator delegator=new InstanceStatusEventMessageDelegator();
    Thread tdelegator=new Thread(delegator);
    tdelegator.start();
    BundleContext bundleContext=context.getBundleContext();
    bundleContext.registerService(CloudControllerService.class.getName(),new CloudControllerServiceImpl(),null);
    if (log.isInfoEnabled()) {
      log.info("String_Node_Str");
    }
    TopologySynchronizerTaskScheduler.schedule(ServiceReferenceHolder.getInstance().getTaskService());
    log.debug("String_Node_Str");
  }
 catch (  Throwable e) {
    log.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
protected void activate(ComponentContext context){
  try {
    TopicSubscriber subscriber=new TopicSubscriber(CloudControllerConstants.INSTANCE_TOPIC);
    subscriber.setMessageListener(new InstanceStatusEventMessageListener());
    Thread tsubscriber=new Thread(subscriber);
    tsubscriber.start();
    InstanceStatusEventMessageDelegator delegator=new InstanceStatusEventMessageDelegator();
    Thread tdelegator=new Thread(delegator);
    tdelegator.start();
    BundleContext bundleContext=context.getBundleContext();
    bundleContext.registerService(CloudControllerService.class.getName(),new CloudControllerServiceImpl(),null);
    if (log.isInfoEnabled()) {
      log.info("String_Node_Str");
    }
    TopologySynchronizerTaskScheduler.schedule(ServiceReferenceHolder.getInstance().getTaskService());
  }
 catch (  Throwable e) {
    log.error("String_Node_Str",e);
  }
}
Program: 116741
Project: 116741
Buggy source:
protected void setRegistryService(RegistryService registryService){
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str");
  }
  try {
    ServiceReferenceHolder.getInstance().setRegistry(registryService.getGovernanceSystemRegistry());
  }
 catch (  RegistryException e) {
    String msg="String_Node_Str";
    log.error(msg,e);
    throw new CloudControllerException(msg,e);
  }
}

Fixed version (ground truth):
protected void setRegistryService(RegistryService registryService){
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str");
  }
  try {
    UserRegistry registry=registryService.getGovernanceSystemRegistry();
    ServiceReferenceHolder.getInstance().setRegistry(registry);
  }
 catch (  RegistryException e) {
    String msg="String_Node_Str";
    log.error(msg,e);
    throw new CloudControllerException(msg,e);
  }
}
Program: 116742
Project: 116742
Buggy source:
public Object retrieveTopology(){
  try {
    Resource resource=registryService.get(CloudControllerConstants.CLOUD_CONTROLLER_RESOURCE + CloudControllerConstants.TOPOLOGY_RESOURCE);
    return resource.getContent();
  }
 catch (  ResourceNotFoundException ignore) {
    return null;
  }
catch (  RegistryException e) {
    String msg="String_Node_Str";
    log.error(msg,e);
    throw new CloudControllerException(msg,e);
  }
}

Fixed version (ground truth):
public Object retrieveTopology(){
  try {
    PrivilegedCarbonContext ctx=PrivilegedCarbonContext.getThreadLocalCarbonContext();
    ctx.setTenantId(MultitenantConstants.SUPER_TENANT_ID);
    ctx.setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
    Resource resource=registryService.get(CloudControllerConstants.CLOUD_CONTROLLER_RESOURCE + CloudControllerConstants.TOPOLOGY_RESOURCE);
    return resource.getContent();
  }
 catch (  ResourceNotFoundException ignore) {
    return null;
  }
catch (  RegistryException e) {
    String msg="String_Node_Str";
    log.error(msg,e);
    throw new CloudControllerException(msg,e);
  }
}
Program: 116743
Project: 116743
Buggy source:
public Object retrieve(){
  try {
    Resource resource=registryService.get(CloudControllerConstants.CLOUD_CONTROLLER_RESOURCE + CloudControllerConstants.DATA_RESOURCE);
    return resource.getContent();
  }
 catch (  ResourceNotFoundException ignore) {
    return null;
  }
catch (  RegistryException e) {
    String msg="String_Node_Str";
    log.error(msg,e);
    throw new CloudControllerException(msg,e);
  }
}

Fixed version (ground truth):
public Object retrieve(){
  try {
    PrivilegedCarbonContext ctx=PrivilegedCarbonContext.getThreadLocalCarbonContext();
    ctx.setTenantId(MultitenantConstants.SUPER_TENANT_ID);
    ctx.setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
    Resource resource=registryService.get(CloudControllerConstants.CLOUD_CONTROLLER_RESOURCE + CloudControllerConstants.DATA_RESOURCE);
    return resource.getContent();
  }
 catch (  ResourceNotFoundException ignore) {
    return null;
  }
catch (  RegistryException e) {
    String msg="String_Node_Str";
    log.error(msg,e);
    throw new CloudControllerException(msg,e);
  }
}
Program: 116744
Project: 116744
Buggy source:
protected void activate(ComponentContext context){
  try {
    bundleContext=context.getBundleContext();
    if (CommonUtil.getStratosConfig() == null) {
      StratosConfiguration stratosConfig=CommonUtil.loadStratosConfiguration();
      CommonUtil.setStratosConfig(stratosConfig);
    }
    if (CommonUtil.getEula() == null) {
      String eula=CommonUtil.loadTermsOfUsage();
      CommonUtil.setEula(eula);
    }
    try {
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str");
      }
    }
 catch (    Exception ex) {
      String msg="String_Node_Str";
      log.error(msg,ex);
    }
  }
 catch (  Throwable e) {
    log.error("String_Node_Str" + e.toString());
  }
}

Fixed version (ground truth):
protected void activate(ComponentContext context){
  try {
    bundleContext=context.getBundleContext();
    if (CommonUtil.getStratosConfig() == null) {
      StratosConfiguration stratosConfig=CommonUtil.loadStratosConfiguration();
      CommonUtil.setStratosConfig(stratosConfig);
    }
    if (CommonUtil.getEula() == null) {
      String eula=CommonUtil.loadTermsOfUsage();
      CommonUtil.setEula(eula);
    }
    try {
      StratosConfiguration stratosConfiguration=CommonUtil.loadStratosConfiguration();
      bundleContext.registerService(StratosConfiguration.class.getName(),stratosConfiguration,null);
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str");
      }
    }
 catch (    Exception ex) {
      String msg="String_Node_Str";
      log.error(msg,ex);
    }
  }
 catch (  Throwable e) {
    log.error("String_Node_Str" + e.toString());
  }
}
Program: 116745
Project: 116745
Buggy source:
public NetworkPartitionContext(String id){
  super();
  this.id=id;
  this.setServiceToLBClusterId(new HashMap<String,String>());
  this.setClusterIdToLBClusterIdMap(new HashMap<String,String>());
  partitionCtxts=new HashMap<String,PartitionContext>();
}

Fixed version (ground truth):
public NetworkPartitionContext(String id,String partitionAlgo){
  super();
  this.id=id;
  this.partitionAlgorithm=partitionAlgo;
  this.setServiceToLBClusterId(new HashMap<String,String>());
  this.setClusterIdToLBClusterIdMap(new HashMap<String,String>());
  partitionCtxts=new HashMap<String,PartitionContext>();
}
Program: 116746
Project: 116746
Buggy source:
public Partition getNextScaleUpPartition(NetworkPartitionContext networkPartitionContext,String clusterId){
  int currentPartitionIndex=networkPartitionContext.getCurrentPartitionIndex();
  List<?> partitions=Arrays.asList(networkPartitionContext.getPartitions());
  int noOfPartitions=partitions.size();
  for (int i=currentPartitionIndex; i < noOfPartitions; i++) {
    if (partitions.get(currentPartitionIndex) instanceof Partition) {
      currentPartitionIndex=networkPartitionContext.getCurrentPartitionIndex();
      Partition currentPartition=(Partition)partitions.get(currentPartitionIndex);
      String currentPartitionId=currentPartition.getId();
      if (networkPartitionContext.getMemberCountOfPartition(currentPartitionId) < currentPartition.getPartitionMax()) {
        if (log.isDebugEnabled())         log.debug("String_Node_Str" + currentPartition.getId());
        return currentPartition;
      }
 else {
        if (currentPartitionIndex == noOfPartitions - 1) {
          if (log.isDebugEnabled())           log.debug("String_Node_Str");
          return null;
        }
        networkPartitionContext.setCurrentPartitionIndex(currentPartitionIndex + 1);
      }
    }
  }
  if (log.isDebugEnabled())   log.debug("String_Node_Str" + networkPartitionContext);
  return null;
}

Fixed version (ground truth):
public Partition getNextScaleUpPartition(NetworkPartitionContext networkPartitionContext,String clusterId){
  int currentPartitionIndex=networkPartitionContext.getCurrentPartitionIndex();
  List<?> partitions=Arrays.asList(networkPartitionContext.getPartitions());
  int noOfPartitions=partitions.size();
  if (log.isDebugEnabled()) {
    log.debug(String.format("String_Node_Str" + "String_Node_Str",noOfPartitions,networkPartitionContext.getId()));
  }
  for (int i=currentPartitionIndex; i < noOfPartitions; i++) {
    if (partitions.get(currentPartitionIndex) instanceof Partition) {
      currentPartitionIndex=networkPartitionContext.getCurrentPartitionIndex();
      Partition currentPartition=(Partition)partitions.get(currentPartitionIndex);
      String currentPartitionId=currentPartition.getId();
      if (networkPartitionContext.getMemberCountOfPartition(currentPartitionId) < currentPartition.getPartitionMax()) {
        if (log.isDebugEnabled())         log.debug("String_Node_Str" + currentPartition.getId());
        return currentPartition;
      }
 else {
        if (currentPartitionIndex == noOfPartitions - 1) {
          if (log.isDebugEnabled())           log.debug("String_Node_Str");
          return null;
        }
        networkPartitionContext.setCurrentPartitionIndex(currentPartitionIndex + 1);
      }
    }
  }
  if (log.isDebugEnabled())   log.debug("String_Node_Str" + networkPartitionContext);
  return null;
}
Program: 116747
Project: 116747
Buggy source:
public Partition getNextScaleUpPartition(NetworkPartitionContext networkPartitionContext,String clusterId){
  List<?> partitions=Arrays.asList(networkPartitionContext.getPartitions());
  int noOfPartitions=partitions.size();
  for (int i=0; i < noOfPartitions; i++) {
    int currentPartitionIndex=networkPartitionContext.getCurrentPartitionIndex();
    if (partitions.get(currentPartitionIndex) instanceof Partition) {
      Partition currentPartition=(Partition)partitions.get(currentPartitionIndex);
      String currentPartitionId=currentPartition.getId();
      int nextPartitionIndex=currentPartitionIndex == noOfPartitions - 1 ? 0 : currentPartitionIndex + 1;
      networkPartitionContext.setCurrentPartitionIndex(nextPartitionIndex);
      if (networkPartitionContext.getMemberCountOfPartition(currentPartitionId) < currentPartition.getPartitionMax()) {
        if (log.isDebugEnabled())         log.debug("String_Node_Str" + currentPartition.getId());
        return currentPartition;
      }
      if (log.isDebugEnabled())       log.debug("String_Node_Str" + currentPartition.getId());
    }
  }
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + networkPartitionContext);
  }
  return null;
}

Fixed version (ground truth):
public Partition getNextScaleUpPartition(NetworkPartitionContext networkPartitionContext,String clusterId){
  List<?> partitions=Arrays.asList(networkPartitionContext.getPartitions());
  int noOfPartitions=partitions.size();
  if (log.isDebugEnabled()) {
    log.debug(String.format("String_Node_Str" + "String_Node_Str",noOfPartitions,networkPartitionContext.getId()));
  }
  for (int i=0; i < noOfPartitions; i++) {
    int currentPartitionIndex=networkPartitionContext.getCurrentPartitionIndex();
    if (partitions.get(currentPartitionIndex) instanceof Partition) {
      Partition currentPartition=(Partition)partitions.get(currentPartitionIndex);
      String currentPartitionId=currentPartition.getId();
      int nextPartitionIndex=currentPartitionIndex == noOfPartitions - 1 ? 0 : currentPartitionIndex + 1;
      networkPartitionContext.setCurrentPartitionIndex(nextPartitionIndex);
      if (networkPartitionContext.getMemberCountOfPartition(currentPartitionId) < currentPartition.getPartitionMax()) {
        if (log.isDebugEnabled())         log.debug("String_Node_Str" + currentPartition.getId());
        return currentPartition;
      }
      if (log.isDebugEnabled())       log.debug("String_Node_Str" + currentPartition.getId());
    }
  }
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + networkPartitionContext);
  }
  return null;
}
Program: 116748
Project: 116748
Buggy source:
public void deployNewNetworkPartitions(DeploymentPolicy depPolicy){
  for (  PartitionGroup partitionGroup : depPolicy.getPartitionGroups()) {
    String id=partitionGroup.getId();
    if (!networkPartitionContexts.containsKey(id)) {
      NetworkPartitionContext networkPartitionContext=new NetworkPartitionContext(id);
      addNetworkPartitionContext(networkPartitionContext);
      RegistryManager.getInstance().persistNetworkPartition(networkPartitionContext);
    }
  }
}

Fixed version (ground truth):
public void deployNewNetworkPartitions(DeploymentPolicy depPolicy){
  for (  PartitionGroup partitionGroup : depPolicy.getPartitionGroups()) {
    String id=partitionGroup.getId();
    if (!networkPartitionContexts.containsKey(id)) {
      NetworkPartitionContext networkPartitionContext=new NetworkPartitionContext(id,partitionGroup.getPartitionAlgo());
      addNetworkPartitionContext(networkPartitionContext);
      RegistryManager.getInstance().persistNetworkPartition(networkPartitionContext);
    }
  }
}
Program: 116749
Project: 116749
Buggy source:
public AutoscaleAlgorithm getAutoscaleAlgorithm(String partitionAlgorithm){
  AutoscaleAlgorithm autoscaleAlgorithm=null;
  if (Constants.ROUND_ROBIN_ALGORITHM_ID.equals(partitionAlgorithm)) {
    autoscaleAlgorithm=new RoundRobin();
  }
 else   if (Constants.ONE_AFTER_ANOTHER_ALGORITHM_ID.equals(partitionAlgorithm)) {
    autoscaleAlgorithm=new OneAfterAnother();
  }
  return autoscaleAlgorithm;
}

Fixed version (ground truth):
public AutoscaleAlgorithm getAutoscaleAlgorithm(String partitionAlgorithm){
  AutoscaleAlgorithm autoscaleAlgorithm=null;
  if (log.isDebugEnabled()) {
    log.debug(String.format("String_Node_Str",partitionAlgorithm));
  }
  if (Constants.ROUND_ROBIN_ALGORITHM_ID.equals(partitionAlgorithm)) {
    autoscaleAlgorithm=new RoundRobin();
  }
 else   if (Constants.ONE_AFTER_ANOTHER_ALGORITHM_ID.equals(partitionAlgorithm)) {
    autoscaleAlgorithm=new OneAfterAnother();
  }
  return autoscaleAlgorithm;
}
Program: 116751
Project: 116751
Buggy source:
@Override public void run(){
  try {
    if (log.isInfoEnabled()) {
      log.info("String_Node_Str");
    }
    topologyReceiver=new TopologyReceiver(createMessageDelegator());
    Thread topologyReceiverThread=new Thread(topologyReceiver);
    topologyReceiverThread.start();
    inFlightRequestCountNotifier=new LoadBalancerInFlightRequestCountNotifier(statsReader);
    Thread statsNotifierThread=new Thread(inFlightRequestCountNotifier);
    statsNotifierThread.start();
    while (!terminated)     ;
  }
 catch (  Exception e) {
    if (log.isErrorEnabled()) {
      log.error("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    if (log.isInfoEnabled()) {
      log.info("String_Node_Str");
    }
    topologyReceiver=new TopologyReceiver(createMessageDelegator());
    Thread topologyReceiverThread=new Thread(topologyReceiver);
    topologyReceiverThread.start();
    statisticsNotifier=new LoadBalancerStatisticsNotifier(statsReader);
    Thread statsNotifierThread=new Thread(statisticsNotifier);
    statsNotifierThread.start();
    while (!terminated)     ;
  }
 catch (  Exception e) {
    if (log.isErrorEnabled()) {
      log.error("String_Node_Str",e);
    }
  }
}
Program: 116752
Project: 116752
Buggy source:
public LoadBalancerExtension(LoadBalancer loadBalancer,LoadBalancerStatsReader statsReader){
  this.loadBalancer=loadBalancer;
  this.statsReader=statsReader;
}

Fixed version (ground truth):
public LoadBalancerExtension(LoadBalancer loadBalancer,LoadBalancerStatisticsReader statsReader){
  this.loadBalancer=loadBalancer;
  this.statsReader=statsReader;
}
Program: 116753
Project: 116753
Buggy source:
public void terminate(){
  topologyReceiver.terminate();
  inFlightRequestCountNotifier.terminate();
  terminated=true;
}

Fixed version (ground truth):
public void terminate(){
  topologyReceiver.terminate();
  statisticsNotifier.terminate();
  terminated=true;
}
Program: 116754
Project: 116754
Buggy source:
private void incrementInFlightRequestCount(MessageContext messageContext){
  try {
    String clusterId=(String)messageContext.getProperty(Constants.CLUSTER_ID);
    if (StringUtils.isBlank(clusterId)) {
      throw new RuntimeException("String_Node_Str");
    }
    LoadBalancerInFlightRequestCountCollector.getInstance().incrementInFlightRequestCount(clusterId);
  }
 catch (  Exception e) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
private void incrementInFlightRequestCount(MessageContext messageContext){
  try {
    String clusterId=(String)messageContext.getProperty(Constants.CLUSTER_ID);
    if (StringUtils.isBlank(clusterId)) {
      throw new RuntimeException("String_Node_Str");
    }
    LoadBalancerStatisticsCollector.getInstance().incrementInFlightRequestCount(clusterId);
  }
 catch (  Exception e) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str",e);
    }
  }
}
Program: 116755
Project: 116755
Buggy source:
protected void deactivate(ComponentContext context){
  try {
    Set<Map.Entry<Integer,SynapseEnvironmentService>> entrySet=LoadBalancerContext.getInstance().getTenantIdSynapseEnvironmentServiceMap().getTenantIdSynapseEnvironmentServiceMap().entrySet();
    for (    Map.Entry<Integer,SynapseEnvironmentService> entry : entrySet) {
      unregisterDeployer(entry.getValue().getConfigurationContext().getAxisConfiguration(),entry.getValue().getSynapseEnvironment());
    }
  }
 catch (  Exception e) {
    log.warn("String_Node_Str");
  }
  tenantReceiver.terminate();
  topologyReceiver.terminate();
}

Fixed version (ground truth):
protected void deactivate(ComponentContext context){
  try {
    Set<Map.Entry<Integer,SynapseEnvironmentService>> entrySet=LoadBalancerContext.getInstance().getTenantIdSynapseEnvironmentServiceMap().getTenantIdSynapseEnvironmentServiceMap().entrySet();
    for (    Map.Entry<Integer,SynapseEnvironmentService> entry : entrySet) {
      unregisterDeployer(entry.getValue().getConfigurationContext().getAxisConfiguration(),entry.getValue().getSynapseEnvironment());
    }
  }
 catch (  Exception e) {
    log.warn("String_Node_Str");
  }
  tenantReceiver.terminate();
  topologyReceiver.terminate();
  statisticsNotifier.terminate();
}
Program: 116757
Project: 116757
Buggy source:
public boolean mediate(MessageContext messageContext){
  try {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str");
    }
    String clusterId=(String)messageContext.getProperty(Constants.CLUSTER_ID);
    if (StringUtils.isBlank(clusterId)) {
      throw new RuntimeException("String_Node_Str");
    }
    LoadBalancerInFlightRequestCountCollector.getInstance().decrementInFlightRequestCount(clusterId);
  }
 catch (  Exception e) {
    if (log.isErrorEnabled()) {
      log.error("String_Node_Str",e);
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean mediate(MessageContext messageContext){
  try {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str");
    }
    String clusterId=(String)messageContext.getProperty(Constants.CLUSTER_ID);
    if (StringUtils.isBlank(clusterId)) {
      throw new RuntimeException("String_Node_Str");
    }
    LoadBalancerStatisticsCollector.getInstance().decrementInFlightRequestCount(clusterId);
  }
 catch (  Exception e) {
    if (log.isErrorEnabled()) {
      log.error("String_Node_Str",e);
    }
  }
  return true;
}
Program: 116758
Project: 116758
Buggy source:
@SuppressWarnings("String_Node_Str") public Partition[] getAllPartitions(){
  ArrayList<Partition> partitionslist=new ArrayList<Partition>();
  for (  PartitionGroup partitionGroup : this.getPartitionGroups()) {
    Partition[] partitions=partitionGroup.getPartitions();
    if (partitions != null) {
      partitionslist.addAll(Arrays.asList(partitions));
    }
  }
  return partitionslist.toArray(new Partition[0]);
}

Fixed version (ground truth):
public Partition[] getAllPartitions(){
  ArrayList<Partition> partitionslist=new ArrayList<Partition>();
  for (  PartitionGroup partitionGroup : this.getPartitionGroups()) {
    Partition[] partitions=partitionGroup.getPartitions();
    if (partitions != null) {
      partitionslist.addAll(Arrays.asList(partitions));
    }
  }
  return partitionslist.toArray(new Partition[0]);
}
Program: 116759
Project: 116759
Buggy source:
public String toString(){
  return "String_Node_Str" + this.id;
}

Fixed version (ground truth):
public String toString(){
  return "String_Node_Str" + this.id + "String_Node_Str"+ Arrays.toString(this.getAllPartitions());
}
Program: 116760
Project: 116760
Buggy source:
public List<DeploymentPolicy> retrieveDeploymentPolicies(){
  List<DeploymentPolicy> depPolicyList=new ArrayList<DeploymentPolicy>();
  RegistryManager registryManager=RegistryManager.getInstance();
  String[] depPolicyResourceList=(String[])registryManager.retrieve(AutoScalerConstants.AUTOSCALER_RESOURCE + AutoScalerConstants.DEPLOYMENT_POLICY_RESOURCE);
  if (depPolicyResourceList != null) {
    DeploymentPolicy depPolicy;
    for (    String resourcePath : depPolicyResourceList) {
      Object serializedObj=registryManager.retrieve(resourcePath);
      if (serializedObj != null) {
        try {
          Object dataObj=Deserializer.deserializeFromByteArray((byte[])serializedObj);
          if (dataObj instanceof DeploymentPolicy) {
            depPolicy=(DeploymentPolicy)dataObj;
            if (log.isDebugEnabled()) {
              log.debug(String.format("String_Node_Str",depPolicy.getId(),depPolicy.getAllPartitions()));
            }
            depPolicyList.add(depPolicy);
          }
 else {
            return null;
          }
        }
 catch (        Exception e) {
          String msg="String_Node_Str";
          log.warn(msg,e);
        }
      }
    }
  }
  return depPolicyList;
}

Fixed version (ground truth):
public List<DeploymentPolicy> retrieveDeploymentPolicies(){
  List<DeploymentPolicy> depPolicyList=new ArrayList<DeploymentPolicy>();
  RegistryManager registryManager=RegistryManager.getInstance();
  String[] depPolicyResourceList=(String[])registryManager.retrieve(AutoScalerConstants.AUTOSCALER_RESOURCE + AutoScalerConstants.DEPLOYMENT_POLICY_RESOURCE);
  if (depPolicyResourceList != null) {
    DeploymentPolicy depPolicy;
    for (    String resourcePath : depPolicyResourceList) {
      Object serializedObj=registryManager.retrieve(resourcePath);
      if (serializedObj != null) {
        try {
          Object dataObj=Deserializer.deserializeFromByteArray((byte[])serializedObj);
          if (dataObj instanceof DeploymentPolicy) {
            depPolicy=(DeploymentPolicy)dataObj;
            if (log.isDebugEnabled()) {
              log.debug(depPolicy.toString());
            }
            depPolicyList.add(depPolicy);
          }
 else {
            return null;
          }
        }
 catch (        Exception e) {
          String msg="String_Node_Str";
          log.warn(msg,e);
        }
      }
    }
  }
  return depPolicyList;
}
Program: 116761
Project: 116761
Buggy source:
public void persistDeploymentPolicy(DeploymentPolicy deploymentPolicy){
  String resourcePath=AutoScalerConstants.AUTOSCALER_RESOURCE + AutoScalerConstants.DEPLOYMENT_POLICY_RESOURCE + "String_Node_Str"+ deploymentPolicy.getId();
  persist(deploymentPolicy,resourcePath);
  if (log.isDebugEnabled()) {
    log.debug(String.format("String_Node_Str",deploymentPolicy.getId(),deploymentPolicy.getAllPartitions()));
  }
}

Fixed version (ground truth):
public void persistDeploymentPolicy(DeploymentPolicy deploymentPolicy){
  String resourcePath=AutoScalerConstants.AUTOSCALER_RESOURCE + AutoScalerConstants.DEPLOYMENT_POLICY_RESOURCE + "String_Node_Str"+ deploymentPolicy.getId();
  persist(deploymentPolicy,resourcePath);
  if (log.isDebugEnabled()) {
    log.debug(deploymentPolicy.toString());
  }
}
Program: 116763
Project: 116763
Buggy source:
private void onArtifactUpdateEvent(ArtifactUpdatedEvent event){
  ArtifactUpdatedEvent artifactUpdatedEvent=(ArtifactUpdatedEvent)event;
  if (log.isDebugEnabled()) {
    log.debug(String.format("String_Node_Str",artifactUpdatedEvent.toString()));
  }
  String clusterIdInPayload=CartridgeAgentConfiguration.getInstance().getClusterId();
  String localRepoPath=CartridgeAgentConfiguration.getInstance().getAppPath();
  String clusterIdInMessage=artifactUpdatedEvent.getClusterId();
  String repoURL=artifactUpdatedEvent.getRepoURL();
  String repoPassword=CartridgeAgentUtils.decryptPassword(artifactUpdatedEvent.getRepoPassword());
  String repoUsername=artifactUpdatedEvent.getRepoUserName();
  String tenantId=artifactUpdatedEvent.getTenantId();
  if (StringUtils.isNotEmpty(repoURL) && (clusterIdInPayload != null) && clusterIdInPayload.equals(clusterIdInMessage)) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str");
    }
    RepositoryInformation repoInformation=new RepositoryInformation();
    repoInformation.setRepoUsername(repoUsername);
    repoInformation.setRepoPassword(repoPassword);
    repoInformation.setRepoUrl(repoURL);
    repoInformation.setRepoPath(localRepoPath);
    repoInformation.setTenantId(tenantId);
    boolean cloneExists=GitBasedArtifactRepository.cloneExists(repoInformation);
    GitBasedArtifactRepository.checkout(repoInformation);
    if (!cloneExists) {
      CartridgeAgentEventPublisher.publishInstanceActivatedEvent();
    }
  }
}

Fixed version (ground truth):
private void onArtifactUpdateEvent(ArtifactUpdatedEvent event){
  ArtifactUpdatedEvent artifactUpdatedEvent=(ArtifactUpdatedEvent)event;
  if (log.isInfoEnabled()) {
    log.info(String.format("String_Node_Str",artifactUpdatedEvent.toString()));
  }
  String clusterIdInPayload=CartridgeAgentConfiguration.getInstance().getClusterId();
  String localRepoPath=CartridgeAgentConfiguration.getInstance().getAppPath();
  String clusterIdInMessage=artifactUpdatedEvent.getClusterId();
  String repoURL=artifactUpdatedEvent.getRepoURL();
  String repoPassword=CartridgeAgentUtils.decryptPassword(artifactUpdatedEvent.getRepoPassword());
  String repoUsername=artifactUpdatedEvent.getRepoUserName();
  String tenantId=artifactUpdatedEvent.getTenantId();
  if (StringUtils.isNotEmpty(repoURL) && (clusterIdInPayload != null) && clusterIdInPayload.equals(clusterIdInMessage)) {
    if (log.isInfoEnabled()) {
      log.info("String_Node_Str");
    }
    RepositoryInformation repoInformation=new RepositoryInformation();
    repoInformation.setRepoUsername(repoUsername);
    repoInformation.setRepoPassword(repoPassword);
    repoInformation.setRepoUrl(repoURL);
    repoInformation.setRepoPath(localRepoPath);
    repoInformation.setTenantId(tenantId);
    boolean cloneExists=GitBasedArtifactRepository.cloneExists(repoInformation);
    GitBasedArtifactRepository.checkout(repoInformation);
    if (!cloneExists) {
      CartridgeAgentEventPublisher.publishInstanceActivatedEvent();
    }
  }
}
Program: 116764
Project: 116764
Buggy source:
public static void main(String[] args){
  try {
    PropertyConfigurator.configure(System.getProperty("String_Node_Str"));
    JndiConfigurator.configure();
    cartridgeAgent=new CartridgeAgent();
    Thread thread=new Thread(cartridgeAgent);
    thread.start();
  }
 catch (  Exception e) {
    if (log.isErrorEnabled()) {
      log.error(e);
    }
    if (cartridgeAgent != null) {
      cartridgeAgent.terminate();
    }
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  try {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str");
    }
    PropertyConfigurator.configure(System.getProperty("String_Node_Str"));
    JndiConfigurator.configure();
    cartridgeAgent=new CartridgeAgent();
    Thread thread=new Thread(cartridgeAgent);
    thread.start();
  }
 catch (  Exception e) {
    if (log.isErrorEnabled()) {
      log.error(e);
    }
    if (cartridgeAgent != null) {
      cartridgeAgent.terminate();
    }
  }
}
Program: 116765
Project: 116765
Buggy source:
private List<Integer> readPorts(){
  List<Integer> ports=new ArrayList<Integer>();
  String portsStr=readParameterValue(CartridgeAgentConstants.PORTS);
  List<String> portsStrList=CartridgeAgentUtils.splitUsingTokenizer(portsStr,"String_Node_Str");
  for (  String portStr : portsStrList) {
    ports.add(Integer.parseInt(portsStr));
  }
  return ports;
}

Fixed version (ground truth):
private List<Integer> readPorts(){
  List<Integer> ports=new ArrayList<Integer>();
  String portsStr=readParameterValue(CartridgeAgentConstants.PORTS);
  List<String> portsStrList=CartridgeAgentUtils.splitUsingTokenizer(portsStr,"String_Node_Str");
  for (  String port : portsStrList) {
    ports.add(Integer.parseInt(port));
  }
  return ports;
}
Program: 116766
Project: 116766
Buggy source:
public static void configure(){
  generateJndiPropertiesFile();
  configured=true;
}

Fixed version (ground truth):
public static void configure(){
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str");
  }
  generateJndiPropertiesFile();
}