nus-yam/ex-repair huggingface dataset:
Program: 115966
Project: 115966
Buggy source:
/** 
 * Get Properties of clustor
 * @param applicationName
 * @param clusterId
 * @return
 * @throws RegistryException
 */
public List<NewProperty> getPropertiesOfCluster(String applicationName,String clusterId) throws RegistryException {
  Registry tempRegistry=ServiceReferenceHolder.getRegistryService().getRegistry();
  String resourcePath=mainResource + applicationName + "String_Node_Str"+ clusterId;
  if (!tempRegistry.resourceExists(resourcePath)) {
    return null;
  }
  Resource regResource=tempRegistry.get(resourcePath);
  ArrayList<NewProperty> newProperties=new ArrayList<NewProperty>();
  Properties props=regResource.getProperties();
  Enumeration<?> x=props.propertyNames();
  while (x.hasMoreElements()) {
    String key=(String)x.nextElement();
    List<String> values=regResource.getPropertyValues(key);
    NewProperty property=new NewProperty();
    property.setKey(key);
    String[] valueArr=new String[values.size()];
    property.setValues(values.toArray(valueArr));
    newProperties.add(property);
  }
  return newProperties;
}

Fixed version (ground truth):
/** 
 * Get Properties of clustor
 * @param applicationName
 * @param clusterId
 * @return
 * @throws RegistryException
 */
public List<NewProperty> getPropertiesOfCluster(String applicationName,String clusterId) throws RegistryException {
  Registry tempRegistry=ServiceReferenceHolder.getInstance().getRegistryService().getRegistry();
  String resourcePath=mainResource + applicationName + "String_Node_Str"+ clusterId;
  if (!tempRegistry.resourceExists(resourcePath)) {
    return null;
  }
  Resource regResource=tempRegistry.get(resourcePath);
  ArrayList<NewProperty> newProperties=new ArrayList<NewProperty>();
  Properties props=regResource.getProperties();
  Enumeration<?> x=props.propertyNames();
  while (x.hasMoreElements()) {
    String key=(String)x.nextElement();
    List<String> values=regResource.getPropertyValues(key);
    NewProperty property=new NewProperty();
    property.setKey(key);
    String[] valueArr=new String[values.size()];
    property.setValues(values.toArray(valueArr));
    newProperties.add(property);
  }
  return newProperties;
}
Program: 115967
Project: 115967
Buggy source:
/** 
 * Add property to cluster
 * @param applicationId
 * @param clusterId
 * @param property
 * @throws RegistryException
 */
public void addPropertyToCluster(String applicationId,String clusterId,NewProperty property) throws RegistryException {
  Registry tempRegistry=ServiceReferenceHolder.getRegistryService().getRegistry();
  String resourcePath=mainResource + applicationId + "String_Node_Str"+ clusterId;
  Resource regResource=createOrGetResourceforCluster(tempRegistry,resourcePath);
  regResource.setProperty(property.getKey(),Arrays.asList(property.getValues()));
  tempRegistry.put(resourcePath,regResource);
  log.info(String.format("String_Node_Str",property.getKey(),clusterId,applicationId));
}

Fixed version (ground truth):
/** 
 * Add property to cluster
 * @param applicationId
 * @param clusterId
 * @param property
 * @throws RegistryException
 */
public void addPropertyToCluster(String applicationId,String clusterId,NewProperty property) throws RegistryException {
  Registry tempRegistry=ServiceReferenceHolder.getInstance().getRegistryService().getRegistry();
  String resourcePath=mainResource + applicationId + "String_Node_Str"+ clusterId;
  Resource regResource=createOrGetResourceforCluster(tempRegistry,resourcePath);
  regResource.setProperty(property.getKey(),Arrays.asList(property.getValues()));
  tempRegistry.put(resourcePath,regResource);
  log.info(String.format("String_Node_Str",property.getKey(),clusterId,applicationId));
}
Program: 115968
Project: 115968
Buggy source:
/** 
 * Delete the resource identified by the applicationId, if exist.
 * @param applicationId ID of the application.
 * @return True if resource exist and able to delete, else false.
 * @throws RegistryException
 */
public boolean deleteApplication(String applicationId) throws RegistryException {
  if (StringUtils.isBlank(applicationId)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Registry tempRegistry=ServiceReferenceHolder.getRegistryService().getRegistry();
  String resourcePath=mainResource + applicationId;
  if (tempRegistry.resourceExists(resourcePath)) {
    tempRegistry.delete(resourcePath);
    log.info(String.format("String_Node_Str",applicationId));
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Delete the resource identified by the applicationId, if exist.
 * @param applicationId ID of the application.
 * @return True if resource exist and able to delete, else false.
 * @throws RegistryException
 */
public boolean deleteApplication(String applicationId) throws RegistryException {
  if (StringUtils.isBlank(applicationId)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Registry tempRegistry=ServiceReferenceHolder.getInstance().getRegistryService().getRegistry();
  String resourcePath=mainResource + applicationId;
  if (tempRegistry.resourceExists(resourcePath)) {
    tempRegistry.delete(resourcePath);
    log.info(String.format("String_Node_Str",applicationId));
    return true;
  }
  return false;
}
Program: 115969
Project: 115969
Buggy source:
/** 
 * Add properties to cluster
 * @param applicationName
 * @param clusterId
 * @param properties
 * @throws RegistryException
 */
public void addPropertiesToCluster(String applicationName,String clusterId,NewProperty[] properties) throws RegistryException {
  Registry tempRegistry=ServiceReferenceHolder.getRegistryService().getRegistry();
  String resourcePath=mainResource + applicationName + "String_Node_Str"+ clusterId;
  Resource regResource;
  regResource=createOrGetResourceforCluster(tempRegistry,resourcePath);
  for (  NewProperty property : properties) {
    regResource.setProperty(property.getKey(),(Arrays.asList(property.getValues())));
  }
  tempRegistry.put(resourcePath,regResource);
  log.info(String.format("String_Node_Str",clusterId,applicationName));
}

Fixed version (ground truth):
/** 
 * Add properties to cluster
 * @param applicationName
 * @param clusterId
 * @param properties
 * @throws RegistryException
 */
public void addPropertiesToCluster(String applicationName,String clusterId,NewProperty[] properties) throws RegistryException {
  Registry tempRegistry=ServiceReferenceHolder.getInstance().getRegistryService().getGovernanceSystemRegistry();
  String resourcePath=mainResource + applicationName + "String_Node_Str"+ clusterId;
  Resource regResource;
  regResource=createOrGetResourceforCluster(tempRegistry,resourcePath);
  for (  NewProperty property : properties) {
    regResource.setProperty(property.getKey(),(Arrays.asList(property.getValues())));
  }
  tempRegistry.put(resourcePath,regResource);
  log.info(String.format("String_Node_Str",clusterId,applicationName));
}
Program: 115970
Project: 115970
Buggy source:
public static ThriftClientConfig getInstance(){
  if (instance == null) {
synchronized (ThriftClientConfig.class) {
      if (instance == null) {
        String defaultConfigFilePath=System.getProperty(CARBON_HOME) + REPOSITORY_CONF + THRIFT_CLIENT_CONFIG_FILE_NAME;
        String configFilePath=System.getProperty(THRIFT_CLIENT_CONFIG_FILE_PATH,defaultConfigFilePath);
        instance=ThriftClientConfigParser.parse(configFilePath);
      }
    }
  }
  return instance;
}

Fixed version (ground truth):
public static ThriftClientConfig getInstance(){
  if (instance == null) {
synchronized (ThriftClientConfig.class) {
      if (instance == null) {
        String configFilePath=System.getProperty(THRIFT_CLIENT_CONFIG_FILE_PATH);
        instance=ThriftClientConfigParser.parse(configFilePath);
      }
    }
  }
  return instance;
}
Program: 115972
Project: 115972
Buggy source:
public void addUsedCartridgeGroupsInCartridgeSubGroups(String cartridgeSubGroupName,String[] cartridgeGroupNames){
  if (cartridgeGroupNames == null) {
    return;
  }
  for (  String cartridgeGroupName : cartridgeGroupNames) {
    Set<String> cartridgeSubGroupNames=null;
    if (cartridgeGroupToCartridgeSubGroupsMap.containsKey(cartridgeGroupName)) {
      cartridgeSubGroupNames=cartridgeTypeToCartridgeGroupsMap.get(cartridgeGroupName);
    }
 else {
      cartridgeSubGroupNames=new HashSet<String>();
      cartridgeGroupToCartridgeSubGroupsMap.put(cartridgeSubGroupName,cartridgeSubGroupNames);
    }
    cartridgeSubGroupNames.add(cartridgeGroupName);
  }
}

Fixed version (ground truth):
public void addUsedCartridgeGroupsInCartridgeSubGroups(String cartridgeSubGroupName,String[] cartridgeGroupNames){
  if (cartridgeGroupNames == null) {
    return;
  }
  for (  String cartridgeGroupName : cartridgeGroupNames) {
    Set<String> cartridgeSubGroupNames=null;
    if (cartridgeGroupToCartridgeSubGroupsMap.containsKey(cartridgeGroupName)) {
      cartridgeSubGroupNames=cartridgeGroupToCartridgeSubGroupsMap.get(cartridgeGroupName);
    }
 else {
      cartridgeSubGroupNames=new HashSet<String>();
      cartridgeGroupToCartridgeSubGroupsMap.put(cartridgeSubGroupName,cartridgeSubGroupNames);
    }
    cartridgeSubGroupNames.add(cartridgeGroupName);
  }
}
Program: 115973
Project: 115973
Buggy source:
public boolean isCartridgeIncludedInCartridgeGroups(String cartridgeName){
  if (cartridgeTypeToApplicationsMap.containsKey(cartridgeName)) {
    if (!cartridgeTypeToApplicationsMap.get(cartridgeName).isEmpty()) {
      return true;
    }
    return false;
  }
  return false;
}

Fixed version (ground truth):
public boolean isCartridgeIncludedInCartridgeGroups(String cartridgeName){
  if (cartridgeTypeToCartridgeGroupsMap.containsKey(cartridgeName)) {
    if (!cartridgeTypeToCartridgeGroupsMap.get(cartridgeName).isEmpty()) {
      return true;
    }
    return false;
  }
  return false;
}
Program: 115976
Project: 115976
Buggy source:
public static void removeServiceGroup(String name) throws RestAPIException {
  try {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + name);
    }
    AutoscalerServiceClient asServiceClient=getAutoscalerServiceClient();
    StratosManagerServiceClient smServiceClient=getStratosManagerServiceClient();
    if (!smServiceClient.canCartirdgeGroupBeRemoved(name)) {
      String message="String_Node_Str" + name + "String_Node_Str";
      log.error(message);
      throw new RestAPIException(message);
    }
    ServiceGroup serviceGroup=asServiceClient.getServiceGroup(name);
    asServiceClient.undeployServiceGroupDefinition(name);
    if (serviceGroup.getCartridges() != null) {
      String[] cartridgeNames=serviceGroup.getCartridges();
      smServiceClient.removeUsedCartridgesInCartridgeGroups(name,cartridgeNames);
    }
    if (serviceGroup.getGroups() != null) {
      ServiceGroup[] cartridgeGroups=serviceGroup.getGroups();
      Set<String> cartridgeGroupNames=new HashSet<String>();
      for (      ServiceGroup cartridgeGroup : cartridgeGroups) {
        cartridgeGroupNames.add(cartridgeGroup.getName());
      }
      smServiceClient.removeUsedCartridgeGroupsInCartridgeSubGroups(name,(String[])cartridgeGroupNames.toArray());
    }
  }
 catch (  Exception e) {
    throw new RestAPIException(e);
  }
  log.info("String_Node_Str" + name);
}

Fixed version (ground truth):
public static void removeServiceGroup(String name) throws RestAPIException {
  try {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + name);
    }
    AutoscalerServiceClient asServiceClient=getAutoscalerServiceClient();
    StratosManagerServiceClient smServiceClient=getStratosManagerServiceClient();
    if (asServiceClient.getServiceGroup(name) == null) {
      String message="String_Node_Str" + name + "String_Node_Str";
      log.error(message);
      throw new RestAPIException(message);
    }
    if (!smServiceClient.canCartirdgeGroupBeRemoved(name)) {
      String message="String_Node_Str" + name + "String_Node_Str";
      log.error(message);
      throw new RestAPIException(message);
    }
    ServiceGroup serviceGroup=asServiceClient.getServiceGroup(name);
    asServiceClient.undeployServiceGroupDefinition(name);
    if (serviceGroup.getCartridges() != null) {
      String[] cartridgeNames=serviceGroup.getCartridges();
      smServiceClient.removeUsedCartridgesInCartridgeGroups(name,cartridgeNames);
    }
    if (serviceGroup.getGroups() != null) {
      ServiceGroup[] cartridgeGroups=serviceGroup.getGroups();
      String[] cartridgeGroupNames=new String[cartridgeGroups.length];
      int i=0;
      for (      ServiceGroup cartridgeGroup : cartridgeGroups) {
        if (cartridgeGroup != null) {
          cartridgeGroupNames[i]=cartridgeGroup.getName();
          i++;
        }
 else {
          break;
        }
      }
      smServiceClient.removeUsedCartridgeGroupsInCartridgeSubGroups(name,cartridgeGroupNames);
    }
  }
 catch (  Exception e) {
    throw new RestAPIException(e);
  }
  log.info("String_Node_Str" + name);
}
Program: 115978
Project: 115978
Buggy source:
public void addUsedCartridgeGroupsInCartridgeSubGroups(String cartridgeSubGroupName,String[] cartridgeGroupNames){
  if (cartridgeGroupNames == null) {
    return;
  }
  for (  String cartridgeGroupName : cartridgeGroupNames) {
    Set<String> cartridgeSubGroupNames=null;
    if (cartridgeGroupToCartridgeSubGroupsMap.containsKey(cartridgeGroupName)) {
      cartridgeSubGroupNames=cartridgeTypeToCartridgeGroupsMap.get(cartridgeGroupName);
    }
 else {
      cartridgeSubGroupNames=new HashSet<String>();
      cartridgeGroupToCartridgeSubGroupsMap.put(cartridgeSubGroupName,cartridgeSubGroupNames);
    }
    cartridgeSubGroupNames.add(cartridgeGroupName);
  }
}

Fixed version (ground truth):
public void addUsedCartridgeGroupsInCartridgeSubGroups(String cartridgeSubGroupName,String[] cartridgeGroupNames){
  if (cartridgeGroupNames == null) {
    return;
  }
  for (  String cartridgeGroupName : cartridgeGroupNames) {
    Set<String> cartridgeSubGroupNames=null;
    if (cartridgeGroupToCartridgeSubGroupsMap.containsKey(cartridgeGroupName)) {
      cartridgeSubGroupNames=cartridgeGroupToCartridgeSubGroupsMap.get(cartridgeGroupName);
    }
 else {
      cartridgeSubGroupNames=new HashSet<String>();
      cartridgeGroupToCartridgeSubGroupsMap.put(cartridgeSubGroupName,cartridgeSubGroupNames);
    }
    cartridgeSubGroupNames.add(cartridgeGroupName);
  }
}
Program: 115979
Project: 115979
Buggy source:
public boolean isCartridgeIncludedInCartridgeGroups(String cartridgeName){
  if (cartridgeTypeToApplicationsMap.containsKey(cartridgeName)) {
    if (!cartridgeTypeToApplicationsMap.get(cartridgeName).isEmpty()) {
      return true;
    }
    return false;
  }
  return false;
}

Fixed version (ground truth):
public boolean isCartridgeIncludedInCartridgeGroups(String cartridgeName){
  if (cartridgeTypeToCartridgeGroupsMap.containsKey(cartridgeName)) {
    if (!cartridgeTypeToCartridgeGroupsMap.get(cartridgeName).isEmpty()) {
      return true;
    }
    return false;
  }
  return false;
}
Program: 115982
Project: 115982
Buggy source:
public static void removeServiceGroup(String name) throws RestAPIException {
  try {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + name);
    }
    AutoscalerServiceClient asServiceClient=getAutoscalerServiceClient();
    StratosManagerServiceClient smServiceClient=getStratosManagerServiceClient();
    if (!smServiceClient.canCartirdgeGroupBeRemoved(name)) {
      String message="String_Node_Str" + name + "String_Node_Str";
      log.error(message);
      throw new RestAPIException(message);
    }
    ServiceGroup serviceGroup=asServiceClient.getServiceGroup(name);
    asServiceClient.undeployServiceGroupDefinition(name);
    if (serviceGroup.getCartridges() != null) {
      String[] cartridgeNames=serviceGroup.getCartridges();
      smServiceClient.removeUsedCartridgesInCartridgeGroups(name,cartridgeNames);
    }
    if (serviceGroup.getGroups() != null) {
      ServiceGroup[] cartridgeGroups=serviceGroup.getGroups();
      Set<String> cartridgeGroupNames=new HashSet<String>();
      for (      ServiceGroup cartridgeGroup : cartridgeGroups) {
        cartridgeGroupNames.add(cartridgeGroup.getName());
      }
      smServiceClient.removeUsedCartridgeGroupsInCartridgeSubGroups(name,(String[])cartridgeGroupNames.toArray());
    }
  }
 catch (  Exception e) {
    throw new RestAPIException(e);
  }
  log.info("String_Node_Str" + name);
}

Fixed version (ground truth):
public static void removeServiceGroup(String name) throws RestAPIException {
  try {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + name);
    }
    AutoscalerServiceClient asServiceClient=getAutoscalerServiceClient();
    StratosManagerServiceClient smServiceClient=getStratosManagerServiceClient();
    if (asServiceClient.getServiceGroup(name) == null) {
      String message="String_Node_Str" + name + "String_Node_Str";
      log.error(message);
      throw new RestAPIException(message);
    }
    if (!smServiceClient.canCartirdgeGroupBeRemoved(name)) {
      String message="String_Node_Str" + name + "String_Node_Str";
      log.error(message);
      throw new RestAPIException(message);
    }
    ServiceGroup serviceGroup=asServiceClient.getServiceGroup(name);
    asServiceClient.undeployServiceGroupDefinition(name);
    if (serviceGroup.getCartridges() != null) {
      String[] cartridgeNames=serviceGroup.getCartridges();
      smServiceClient.removeUsedCartridgesInCartridgeGroups(name,cartridgeNames);
    }
    if (serviceGroup.getGroups() != null) {
      ServiceGroup[] cartridgeGroups=serviceGroup.getGroups();
      String[] cartridgeGroupNames=new String[cartridgeGroups.length];
      int i=0;
      for (      ServiceGroup cartridgeGroup : cartridgeGroups) {
        if (cartridgeGroup != null) {
          cartridgeGroupNames[i]=cartridgeGroup.getName();
          i++;
        }
 else {
          break;
        }
      }
      smServiceClient.removeUsedCartridgeGroupsInCartridgeSubGroups(name,cartridgeGroupNames);
    }
  }
 catch (  Exception e) {
    throw new RestAPIException(e);
  }
  log.info("String_Node_Str" + name);
}
Program: 115984
Project: 115984
Buggy source:
private static String createPortMappingPayloadString(CartridgeInfo cartridge){
  StringBuilder portMapBuilder=new StringBuilder();
  PortMapping[] portMappings=cartridge.getPortMappings();
  for (  PortMapping portMapping : portMappings) {
    String port=portMapping.getPort();
    portMapBuilder.append(port).append("String_Node_Str");
  }
  String portMappingString=portMapBuilder.toString().replaceAll("String_Node_Str","String_Node_Str");
  return portMappingString;
}

Fixed version (ground truth):
private static String createPortMappingPayloadString(CartridgeInfo cartridge){
  StringBuilder portMapBuilder=new StringBuilder();
  PortMapping[] portMappings=cartridge.getPortMappings();
  for (  PortMapping portMapping : portMappings) {
    int port=portMapping.getPort();
    portMapBuilder.append(port).append("String_Node_Str");
  }
  String portMappingString=portMapBuilder.toString().replaceAll("String_Node_Str","String_Node_Str");
  return portMappingString;
}
Program: 115985
Project: 115985
Buggy source:
public String getPort(){
  return port;
}

Fixed version (ground truth):
public int getPort(){
  return port;
}
Program: 115986
Project: 115986
Buggy source:
public String getProxyPort(){
  return proxyPort;
}

Fixed version (ground truth):
public int getProxyPort(){
  return proxyPort;
}
Program: 115987
Project: 115987
Buggy source:
public PortMapping(String protocol,String port,String proxyPort){
  this.protocol=protocol;
  this.port=port;
  this.proxyPort=proxyPort;
}

Fixed version (ground truth):
public PortMapping(String protocol,int port,int proxyPort){
  this.protocol=protocol;
  this.port=port;
  this.proxyPort=proxyPort;
}
Program: 115988
Project: 115988
Buggy source:
public void setPort(String port){
  this.port=port;
}

Fixed version (ground truth):
public void setPort(int port){
  this.port=port;
}
Program: 115989
Project: 115989
Buggy source:
public void setProxyPort(String proxyPort){
  this.proxyPort=proxyPort;
}

Fixed version (ground truth):
public void setProxyPort(int proxyPort){
  this.proxyPort=proxyPort;
}
Program: 115992
Project: 115992
Buggy source:
private static void addToEnvironmentVariables(List<EnvironmentVariable> envVars,String name,String value){
  EnvironmentVariable var=new EnvironmentVariable();
  var.setName(name);
  var.setValue(value);
  envVars.add(var);
}

Fixed version (ground truth):
/** 
 * Add name value pair to kubernetes environment variables.
 * @param environmentVariables
 * @param name
 * @param value
 */
private static void addToEnvironmentVariables(List<EnvironmentVariable> environmentVariables,String name,String value){
  EnvironmentVariable environmentVariable=new EnvironmentVariable();
  environmentVariable.setName(name);
  environmentVariable.setValue(value);
  environmentVariables.add(environmentVariable);
}
Program: 115993
Project: 115993
Buggy source:
public static void sendServiceCreateEvent(List<Cartridge> cartridgeList){
  ServiceCreatedEvent serviceCreatedEvent;
  for (  Cartridge cartridge : cartridgeList) {
    serviceCreatedEvent=new ServiceCreatedEvent(cartridge.getType(),(cartridge.isMultiTenant() ? ServiceType.MultiTenant : ServiceType.SingleTenant));
    Port port;
    List<PortMapping> portMappings=cartridge.getPortMappings();
    for (    PortMapping portMapping : portMappings) {
      port=new Port(portMapping.getProtocol(),Integer.parseInt(portMapping.getPort()),Integer.parseInt(portMapping.getProxyPort()));
      serviceCreatedEvent.addPort(port);
    }
    if (log.isInfoEnabled()) {
      log.info(String.format("String_Node_Str",cartridge.getType()));
    }
    publishEvent(serviceCreatedEvent);
  }
}

Fixed version (ground truth):
public static void sendServiceCreateEvent(List<Cartridge> cartridgeList){
  ServiceCreatedEvent serviceCreatedEvent;
  for (  Cartridge cartridge : cartridgeList) {
    serviceCreatedEvent=new ServiceCreatedEvent(cartridge.getType(),(cartridge.isMultiTenant() ? ServiceType.MultiTenant : ServiceType.SingleTenant));
    Port port;
    List<PortMapping> portMappings=cartridge.getPortMappings();
    for (    PortMapping portMapping : portMappings) {
      port=new Port(portMapping.getProtocol(),portMapping.getPort(),portMapping.getProxyPort());
      serviceCreatedEvent.addPort(port);
    }
    if (log.isInfoEnabled()) {
      log.info(String.format("String_Node_Str",cartridge.getType()));
    }
    publishEvent(serviceCreatedEvent);
  }
}
Program: 115996
Project: 115996
Buggy source:
public static void handleServiceCreated(List<Cartridge> cartridgeList){
  Service service;
  Topology topology=TopologyManager.getTopology();
  if (cartridgeList == null) {
    log.warn(String.format("String_Node_Str"));
    return;
  }
  try {
    TopologyManager.acquireWriteLock();
    for (    Cartridge cartridge : cartridgeList) {
      if (!topology.serviceExists(cartridge.getType())) {
        service=new Service(cartridge.getType(),cartridge.isMultiTenant() ? ServiceType.MultiTenant : ServiceType.SingleTenant);
        List<PortMapping> portMappings=cartridge.getPortMappings();
        Properties properties=new Properties();
        for (        Map.Entry<String,String> entry : cartridge.getProperties().entrySet()) {
          properties.setProperty(entry.getKey(),entry.getValue());
        }
        service.setProperties(properties);
        Port port;
        for (        PortMapping portMapping : portMappings) {
          port=new Port(portMapping.getProtocol(),Integer.parseInt(portMapping.getPort()),Integer.parseInt(portMapping.getProxyPort()));
          service.addPort(port);
        }
        topology.addService(service);
        TopologyManager.updateTopology(topology);
      }
    }
  }
  finally {
    TopologyManager.releaseWriteLock();
  }
  TopologyEventPublisher.sendServiceCreateEvent(cartridgeList);
}

Fixed version (ground truth):
public static void handleServiceCreated(List<Cartridge> cartridgeList){
  Service service;
  Topology topology=TopologyManager.getTopology();
  if (cartridgeList == null) {
    log.warn(String.format("String_Node_Str"));
    return;
  }
  try {
    TopologyManager.acquireWriteLock();
    for (    Cartridge cartridge : cartridgeList) {
      if (!topology.serviceExists(cartridge.getType())) {
        service=new Service(cartridge.getType(),cartridge.isMultiTenant() ? ServiceType.MultiTenant : ServiceType.SingleTenant);
        List<PortMapping> portMappings=cartridge.getPortMappings();
        Properties properties=new Properties();
        for (        Map.Entry<String,String> entry : cartridge.getProperties().entrySet()) {
          properties.setProperty(entry.getKey(),entry.getValue());
        }
        service.setProperties(properties);
        Port port;
        for (        PortMapping portMapping : portMappings) {
          port=new Port(portMapping.getProtocol(),portMapping.getPort(),portMapping.getProxyPort());
          service.addPort(port);
        }
        topology.addService(service);
        TopologyManager.updateTopology(topology);
      }
    }
  }
  finally {
    TopologyManager.releaseWriteLock();
  }
  TopologyEventPublisher.sendServiceCreateEvent(cartridgeList);
}
Program: 115997
Project: 115997
Buggy source:
public void activateTenant(String tenantDomain) throws CommandException {
  DefaultHttpClient httpClient=new DefaultHttpClient();
  try {
    HttpResponse response=restClient.doPost(httpClient,restClient.getBaseURL() + ENDPOINT_ACTIVATE_TENANT + "String_Node_Str"+ tenantDomain,"String_Node_Str");
    String responseCode="String_Node_Str" + response.getStatusLine().getStatusCode();
    GsonBuilder gsonBuilder=new GsonBuilder();
    Gson gson=gsonBuilder.create();
    if (responseCode.equals(CliConstants.RESPONSE_OK)) {
      System.out.println("String_Node_Str" + tenantDomain);
      return;
    }
 else {
      String resultString=CliUtils.getHttpResponseString(response);
      ExceptionMapper exception=gson.fromJson(resultString,ExceptionMapper.class);
      System.out.println(exception);
    }
  }
 catch (  Exception e) {
    String message="String_Node_Str";
    printError(message,e);
  }
 finally {
    httpClient.getConnectionManager().shutdown();
  }
}

Fixed version (ground truth):
public void activateTenant(String tenantDomain) throws CommandException {
  DefaultHttpClient httpClient=new DefaultHttpClient();
  try {
    HttpResponse response=restClient.doPost(httpClient,restClient.getBaseURL() + ENDPOINT_ACTIVATE_TENANT + "String_Node_Str"+ tenantDomain,"String_Node_Str");
    String responseCode="String_Node_Str" + response.getStatusLine().getStatusCode();
    GsonBuilder gsonBuilder=new GsonBuilder();
    Gson gson=gsonBuilder.create();
    if (responseCode.equals(CliConstants.RESPONSE_OK)) {
      System.out.println("String_Node_Str" + tenantDomain + "String_Node_Str");
      return;
    }
 else {
      String resultString=CliUtils.getHttpResponseString(response);
      ExceptionMapper exception=gson.fromJson(resultString,ExceptionMapper.class);
      System.out.println(exception);
    }
  }
 catch (  Exception e) {
    String message="String_Node_Str";
    printError(message,e);
  }
 finally {
    httpClient.getConnectionManager().shutdown();
  }
}
Program: 115998
Project: 115998
Buggy source:
/** 
 * Utility method to build scaling dependencies
 */
public Set<ScalingDependentList> buildScalingDependencies(ParentComponent component){
  Set<ScalingDependentList> scalingDependentLists=new HashSet<ScalingDependentList>();
  if (component.getDependencyOrder() != null && component.getDependencyOrder().getScalingDependents() != null) {
    for (    ScalingDependentList dependentList : component.getDependencyOrder().getScalingDependents()) {
      List<String> scalingDependencies=new ArrayList<String>();
      for (      String string : dependentList.getScalingDependentListComponents()) {
        if (string.startsWith(Constants.GROUP + "String_Node_Str")) {
          scalingDependencies.add(getGroupFromStartupOrder(string));
        }
 else         if (string.startsWith(Constants.CARTRIDGE + "String_Node_Str")) {
          String id=getClusterFromStartupOrder(string);
          ClusterDataHolder clusterDataHolder=(ClusterDataHolder)component.getClusterDataMap().get(id);
          scalingDependencies.add(clusterDataHolder.getClusterId());
        }
 else {
          log.warn("String_Node_Str" + string + "String_Node_Str");
        }
      }
      ScalingDependentList scalingDependentList=new ScalingDependentList(scalingDependencies);
      scalingDependentLists.add(scalingDependentList);
    }
  }
  return scalingDependentLists;
}

Fixed version (ground truth):
/** 
 * Utility method to build scaling dependencies
 */
public Set<ScalingDependentList> buildScalingDependencies(ParentComponent component){
  Set<ScalingDependentList> scalingDependentLists=new HashSet<ScalingDependentList>();
  if (component.getDependencyOrder() != null && component.getDependencyOrder().getScalingDependents() != null) {
    for (    ScalingDependentList dependentList : component.getDependencyOrder().getScalingDependents()) {
      List<String> scalingDependencies=new ArrayList<String>();
      for (      String string : dependentList.getScalingDependentListComponents()) {
        if (string.startsWith(Constants.GROUP + "String_Node_Str")) {
          scalingDependencies.add(getGroupFromStartupOrder(string));
        }
 else         if (string.startsWith(Constants.CARTRIDGE + "String_Node_Str")) {
          String id=getClusterFromStartupOrder(string);
          ClusterDataHolder clusterDataHolder=(ClusterDataHolder)component.getClusterDataForType().get(id);
          scalingDependencies.add(clusterDataHolder.getClusterId());
        }
 else {
          log.warn("String_Node_Str" + string + "String_Node_Str");
        }
      }
      ScalingDependentList scalingDependentList=new ScalingDependentList(scalingDependencies);
      scalingDependentLists.add(scalingDependentList);
    }
  }
  return scalingDependentLists;
}
Program: 115999
Project: 115999
Buggy source:
/** 
 * Will return the GroupChildContext/ClusterChildContext based on the type in start order/scaling order
 * @param order      reference of group/cluster in the start/scaling order
 * @param component       The component which used to build the dependency
 * @param tree kill dependent behaviour of this component
 * @return Context
 */
public static ApplicationChildContext getApplicationContext(String order,ParentComponent component,DependencyTree tree){
  String id;
  ApplicationChildContext applicationContext=null;
  boolean hasDependents=tree.isTerminateDependent() || tree.isTerminateAll();
  if (order.startsWith(Constants.GROUP + "String_Node_Str")) {
    id=getGroupFromStartupOrder(order);
    applicationContext=getGroupChildContext(id,hasDependents);
  }
 else   if (order.startsWith(Constants.CARTRIDGE + "String_Node_Str")) {
    id=getClusterFromStartupOrder(order);
    ClusterDataHolder clusterDataHolder=(ClusterDataHolder)component.getClusterDataMap().get(id);
    applicationContext=getClusterChildContext(clusterDataHolder,hasDependents);
  }
 else {
    log.warn("String_Node_Str" + order + "String_Node_Str");
  }
  return applicationContext;
}

Fixed version (ground truth):
/** 
 * Will return the GroupChildContext/ClusterChildContext based on the type in start order/scaling order
 * @param order      reference of group/cluster in the start/scaling order
 * @param component       The component which used to build the dependency
 * @param tree kill dependent behaviour of this component
 * @return Context
 */
public static ApplicationChildContext getApplicationContext(String order,ParentComponent component,DependencyTree tree){
  String id;
  ApplicationChildContext applicationContext=null;
  boolean hasDependents=tree.isTerminateDependent() || tree.isTerminateAll();
  if (order.startsWith(Constants.GROUP + "String_Node_Str")) {
    id=getGroupFromStartupOrder(order);
    applicationContext=getGroupChildContext(id,hasDependents);
  }
 else   if (order.startsWith(Constants.CARTRIDGE + "String_Node_Str")) {
    id=getClusterFromStartupOrder(order);
    ClusterDataHolder clusterDataHolder=(ClusterDataHolder)component.getClusterDataForType().get(id);
    applicationContext=getClusterChildContext(clusterDataHolder,hasDependents);
  }
 else {
    log.warn("String_Node_Str" + order + "String_Node_Str");
  }
  return applicationContext;
}
Program: 116002
Project: 116002
Buggy source:
/** 
 * Parse Subscription Information
 * @param appId Application id
 * @param tenantId Tenant id of tenant which deployed the Application
 * @param key Generated key for the Application
 * @param groupName Group name (if relevant)
 * @param cartridgeContextList cartridgeContextList
 * @return Map [subscription alias -> ClusterDataHolder]
 * @throws ApplicationDefinitionException
 */
private Map<String,ClusterDataHolder> parseLeafLevelSubscriptions(String appId,int tenantId,String key,String groupName,List<CartridgeContext> cartridgeContextList,Set<StartupOrder> dependencyOrder) throws ApplicationDefinitionException {
}

Fixed version (ground truth):
/** 
 * Parse Subscription Information
 * @param appId Application id
 * @param tenantId Tenant id of tenant which deployed the Application
 * @param key Generated key for the Application
 * @param groupName Group name (if relevant)
 * @param cartridgeContextList cartridgeContextList
 * @return Map [subscription alias -> ClusterDataHolder]
 * @throws ApplicationDefinitionException
 */
private Map<String,Map<String,ClusterDataHolder>> parseLeafLevelSubscriptions(String appId,int tenantId,String key,String groupName,List<CartridgeContext> cartridgeContextList,Set<StartupOrder> dependencyOrder) throws ApplicationDefinitionException {
}
Program: 116003
Project: 116003
Buggy source:
public Instance getInstanceByNetworkPartitionId(String networkPartitionId){
  if (getInstanceIdToInstanceContextMap().isEmpty()) {
    return null;
  }
  for (  Instance instance : instanceIdToInstanceContextMap.values()) {
    if (instance.getNetworkPartitionId().equals(networkPartitionId)) {
      return instance;
    }
  }
  return null;
}

Fixed version (ground truth):
public Instance getInstanceByNetworkPartitionId(String networkPartitionId){
  if (getInstanceIdToInstanceContextMap().isEmpty()) {
    return null;
  }
  for (  Instance instance : getInstanceIdToInstanceContextMap().values()) {
    if (instance.getNetworkPartitionId().equals(networkPartitionId)) {
      return instance;
    }
  }
  return null;
}
Program: 116004
Project: 116004
Buggy source:
public Application(String id){
  super();
  this.id=id;
  this.key=RandomStringUtils.randomAlphanumeric(16);
  this.instanceIdToInstanceContextMap=new HashMap<String,ApplicationInstance>();
}

Fixed version (ground truth):
public Application(String id){
  super();
  this.id=id;
  this.key=RandomStringUtils.randomAlphanumeric(16);
  this.setInstanceIdToInstanceContextMap(new HashMap<String,ApplicationInstance>());
}
Program: 116005
Project: 116005
Buggy source:
public Group(String applicationId,String name,String alias){
  super();
  this.applicationId=applicationId;
  this.name=name;
  this.alias=alias;
  this.instanceIdToInstanceContextMap=new HashMap<String,GroupInstance>();
}

Fixed version (ground truth):
public Group(String applicationId,String name,String alias){
  super();
  this.applicationId=applicationId;
  this.name=name;
  this.alias=alias;
  this.setInstanceIdToInstanceContextMap(new HashMap<String,GroupInstance>());
}
Program: 116006
Project: 116006
Buggy source:
public ParentComponent(){
  this.isGroupScalingEnabled=false;
  this.isGroupInstanceMonitoringEnabled=false;
  aliasToGroupMap=new HashMap<String,Group>();
  aliasToClusterDataMap=new HashMap<String,ClusterDataHolder>();
  instanceIdSequence=new AtomicInteger();
}

Fixed version (ground truth):
public ParentComponent(){
  this.isGroupScalingEnabled=false;
  this.isGroupInstanceMonitoringEnabled=false;
  aliasToGroupMap=new HashMap<String,Group>();
  aliasToClusterDataMap=new HashMap<String,ClusterDataHolder>();
  typeToClusterDataMap=new HashMap<String,ClusterDataHolder>();
  instanceIdSequence=new AtomicInteger();
}
Program: 116007
Project: 116007
Buggy source:
/** 
 * Retrieves InstanceContext obj. for the given instance id
 * @param parentInstanceId parent instance id
 * @return InstanceContext obj. if exists, else null
 */
public List<Instance> getInstanceContextsWithParentId(String parentInstanceId){
  List<Instance> contexts=new ArrayList<Instance>();
  if (getInstanceIdToInstanceContextMap().isEmpty()) {
    return contexts;
  }
  if (parentInstanceId != null) {
    for (    Instance context : instanceIdToInstanceContextMap.values()) {
      if (parentInstanceId.equals(context.getParentId())) {
        contexts.add(context);
      }
    }
  }
  return contexts;
}

Fixed version (ground truth):
/** 
 * Retrieves InstanceContext obj. for the given instance id
 * @param parentInstanceId parent instance id
 * @return InstanceContext obj. if exists, else null
 */
public List<Instance> getInstanceContextsWithParentId(String parentInstanceId){
  List<Instance> contexts=new ArrayList<Instance>();
  if (getInstanceIdToInstanceContextMap().isEmpty()) {
    return contexts;
  }
  if (parentInstanceId != null) {
    for (    Instance context : getInstanceIdToInstanceContextMap().values()) {
      if (parentInstanceId.equals(context.getParentId())) {
        contexts.add(context);
      }
    }
  }
  return contexts;
}
Program: 116008
Project: 116008
Buggy source:
/** 
 * Adds InstanceContext of a child to the instanceIdToInstanceContextMap.
 * @param instanceId instance id of child
 * @param instance   InstanceContext object
 */
public void addInstance(String instanceId,T instance){
  instanceIdToInstanceContextMap.put(instanceId,instance);
}

Fixed version (ground truth):
/** 
 * Adds InstanceContext of a child to the instanceIdToInstanceContextMap.
 * @param instanceId instance id of child
 * @param instance   InstanceContext object
 */
public void addInstance(String instanceId,T instance){
  getInstanceIdToInstanceContextMap().put(instanceId,instance);
}
Program: 116009
Project: 116009
Buggy source:
/** 
 * This will remove the instance from instanceIdToInstanceContextMap
 * @param instanceId instance id of child
 */
public void removeInstance(String instanceId){
  instanceIdToInstanceContextMap.remove(instanceId);
}

Fixed version (ground truth):
/** 
 * This will remove the instance from instanceIdToInstanceContextMap
 * @param instanceId instance id of child
 */
public void removeInstance(String instanceId){
  getInstanceIdToInstanceContextMap().remove(instanceId);
}
Program: 116010
Project: 116010
Buggy source:
public DomainMapping[] getDomainMappings(String applicationId,int tenantId) throws DomainMappingException {
  try {
    ApplicationSignUp applicationSignUp=applicationSignUpHandler.getApplicationSignUp(applicationId,tenantId);
    return applicationSignUp.getDomainMappings();
  }
 catch (  Exception e) {
    String message=String.format("String_Node_Str",applicationId,tenantId);
    log.error(message,e);
    throw new DomainMappingException(message,e);
  }
}

Fixed version (ground truth):
public DomainMapping[] getDomainMappings(String applicationId,int tenantId) throws DomainMappingException {
  try {
    ApplicationSignUp applicationSignUp=applicationSignUpHandler.getApplicationSignUp(applicationId,tenantId);
    if (applicationSignUp != null) {
      return applicationSignUp.getDomainMappings();
    }
    return null;
  }
 catch (  Exception e) {
    String message=String.format("String_Node_Str",applicationId,tenantId);
    log.error(message,e);
    throw new DomainMappingException(message,e);
  }
}
Program: 116015
Project: 116015
Buggy source:
@Override public int getActiveInstanceCount(){
  return getNonTerminatedMemberCount();
}

Fixed version (ground truth):
@Override public int getActiveInstanceCount(){
  return this.activeMembers.size();
}
Program: 116016
Project: 116016
Buggy source:
private static void updateApplicationMonitor(String appId,ApplicationStatus status,String networkPartitionId,String instanceId){
  ApplicationMonitor applicationMonitor=AutoscalerContext.getInstance().getAppMonitor(appId);
  if (applicationMonitor != null) {
    if (status == ApplicationStatus.Active) {
      applicationMonitor.getNetworkPartitionContext(networkPartitionId).movePendingInstanceToActiveInstances(instanceId);
    }
 else     if (status == ApplicationStatus.Terminating) {
      applicationMonitor.setTerminating(true);
      NetworkPartitionContext context=applicationMonitor.getNetworkPartitionContext(networkPartitionId);
      if (context.getActiveInstance(instanceId) != null) {
        context.moveActiveInstanceToTerminationPendingInstances(instanceId);
      }
 else       if (context.getPendingInstance(instanceId) != null) {
        context.movePendingInstanceToTerminationPendingInstances(instanceId);
      }
    }
    applicationMonitor.setStatus(status,instanceId);
  }
 else {
    log.warn("String_Node_Str" + appId);
  }
}

Fixed version (ground truth):
private static void updateApplicationMonitor(String appId,ApplicationStatus status,String networkPartitionId,String instanceId){
  ApplicationMonitor applicationMonitor=AutoscalerContext.getInstance().getAppMonitor(appId);
  NetworkPartitionContext context=applicationMonitor.getNetworkPartitionContext(networkPartitionId);
  if (applicationMonitor != null) {
    if (status == ApplicationStatus.Active) {
      context.movePendingInstanceToActiveInstances(instanceId);
    }
 else     if (status == ApplicationStatus.Terminating) {
      applicationMonitor.setTerminating(true);
      if (context.getActiveInstance(instanceId) != null) {
        context.moveActiveInstanceToTerminationPendingInstances(instanceId);
      }
 else       if (context.getPendingInstance(instanceId) != null) {
        context.movePendingInstanceToTerminationPendingInstances(instanceId);
      }
    }
 else     if (status == ApplicationStatus.Terminated) {
      context.removeTerminationPendingInstance(instanceId);
    }
    applicationMonitor.setStatus(status,instanceId);
  }
 else {
    log.warn("String_Node_Str" + appId);
  }
}
Program: 116018
Project: 116018
Buggy source:
private static void updateGroupMonitor(String appId,String groupId,GroupStatus status,String networkPartitionId,String instanceId,String parentInstanceId){
  GroupMonitor monitor=getGroupMonitor(appId,groupId);
  if (monitor != null) {
    if (status == GroupStatus.Active) {
      monitor.getNetworkPartitionContext(networkPartitionId).movePendingInstanceToActiveInstances(instanceId);
    }
 else     if (status == GroupStatus.Terminating) {
      NetworkPartitionContext context=monitor.getNetworkPartitionContext(networkPartitionId);
      if (context.getActiveInstance(instanceId) != null) {
        context.moveActiveInstanceToTerminationPendingInstances(instanceId);
      }
 else       if (context.getPendingInstance(instanceId) != null) {
        context.movePendingInstanceToTerminationPendingInstances(instanceId);
      }
    }
    monitor.setStatus(status,instanceId,parentInstanceId);
  }
 else {
    log.warn("String_Node_Str" + groupId + "String_Node_Str"+ appId);
  }
}

Fixed version (ground truth):
private static void updateGroupMonitor(String appId,String groupId,GroupStatus status,String networkPartitionId,String instanceId,String parentInstanceId){
  GroupMonitor monitor=getGroupMonitor(appId,groupId);
  if (monitor != null) {
    NetworkPartitionContext context=monitor.getNetworkPartitionContext(networkPartitionId);
    if (status == GroupStatus.Active) {
      context.movePendingInstanceToActiveInstances(instanceId);
    }
 else     if (status == GroupStatus.Terminating) {
      if (context.getActiveInstance(instanceId) != null) {
        context.moveActiveInstanceToTerminationPendingInstances(instanceId);
      }
 else       if (context.getPendingInstance(instanceId) != null) {
        context.movePendingInstanceToTerminationPendingInstances(instanceId);
      }
    }
 else     if (status == GroupStatus.Terminated) {
      context.removeTerminationPendingInstance(instanceId);
    }
    monitor.setStatus(status,instanceId,parentInstanceId);
  }
 else {
    log.warn("String_Node_Str" + groupId + "String_Node_Str"+ appId);
  }
}
Program: 116019
Project: 116019
Buggy source:
public InstanceContext(String id){
  this.id=id;
  setIdToScalingEvent(new HashMap<String,ScalingEvent>());
  setIdToScalingOverMaxEvent(new HashMap<String,ScalingUpBeyondMaxEvent>());
  setIdToScalingDownBeyondMinEvent(new HashMap<String,ScalingDownBeyondMinEvent>());
}

Fixed version (ground truth):
public InstanceContext(String id){
  this.id=id;
  setIdToScalingEvent(new ConcurrentHashMap<String,ScalingEvent>());
  setIdToScalingOverMaxEvent(new ConcurrentHashMap<String,ScalingUpBeyondMaxEvent>());
  setIdToScalingDownBeyondMinEvent(new ConcurrentHashMap<String,ScalingDownBeyondMinEvent>());
}
Program: 116020
Project: 116020
Buggy source:
private void handleScalingMaxOut(NetworkPartitionContext networkPartitionContext){
  if (networkPartitionContext.getPendingInstancesCount() == 0) {
    try {
      if (log.isInfoEnabled()) {
        log.info("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
      }
      handleApplicationBursting();
    }
 catch (    TopologyInConsistentException e) {
      log.error("String_Node_Str",e);
    }
catch (    PolicyValidationException e) {
      log.error("String_Node_Str",e);
    }
catch (    MonitorNotFoundException e) {
      log.error("String_Node_Str",e);
    }
  }
 else {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
private void handleScalingMaxOut(InstanceContext instanceContext,NetworkPartitionContext networkPartitionContext){
  if (networkPartitionContext.getPendingInstancesCount() == 0) {
    try {
      if (log.isInfoEnabled()) {
        log.info("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
      }
      handleApplicationBursting();
    }
 catch (    TopologyInConsistentException e) {
      log.error("String_Node_Str",e);
    }
catch (    PolicyValidationException e) {
      log.error("String_Node_Str",e);
    }
catch (    MonitorNotFoundException e) {
      log.error("String_Node_Str",e);
    }
  }
 else {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + "String_Node_Str");
    }
  }
  instanceContext.setIdToScalingOverMaxEvent(new ConcurrentHashMap<String,ScalingUpBeyondMaxEvent>());
}
Program: 116021
Project: 116021
Buggy source:
@Override public void run(){
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + appId + "String_Node_Str");
  }
  for (  NetworkPartitionContext networkPartitionContext : networkPartitionContexts) {
    for (    InstanceContext instanceContext : networkPartitionContext.getInstanceIdToInstanceContextMap().values()) {
      ApplicationInstance instance=(ApplicationInstance)instanceIdToInstanceMap.get(instanceContext.getId());
      if (instance.getStatus().getCode() <= GroupStatus.Active.getCode()) {
        if (!instanceContext.getIdToScalingOverMaxEvent().isEmpty()) {
          handleScalingMaxOut(networkPartitionContext);
        }
 else         if (!instanceContext.getIdToScalingEvent().isEmpty()) {
          handleDependentScaling(instanceContext,networkPartitionContext);
        }
 else         if (!instanceContext.getIdToScalingDownBeyondMinEvent().isEmpty()) {
          handleScalingDownBeyondMin(instanceContext,networkPartitionContext);
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + appId + "String_Node_Str");
  }
  for (  NetworkPartitionContext networkPartitionContext : networkPartitionContexts) {
    for (    InstanceContext instanceContext : networkPartitionContext.getInstanceIdToInstanceContextMap().values()) {
      ApplicationInstance instance=(ApplicationInstance)instanceIdToInstanceMap.get(instanceContext.getId());
      if (instance.getStatus().getCode() <= GroupStatus.Active.getCode()) {
        if (!instanceContext.getIdToScalingOverMaxEvent().isEmpty()) {
          handleScalingMaxOut(instanceContext,networkPartitionContext);
        }
 else         if (!instanceContext.getIdToScalingEvent().isEmpty()) {
          handleDependentScaling(instanceContext,networkPartitionContext);
        }
 else         if (!instanceContext.getIdToScalingDownBeyondMinEvent().isEmpty()) {
          handleScalingDownBeyondMin(instanceContext,networkPartitionContext);
        }
      }
    }
  }
}