nus-yam/ex-repair huggingface dataset:
Program: 115547
Project: 115547
Buggy source:
/** 
 * Remove network partition by network partition id
 * @return 200 if specified network partition is successfully deleted, 404 if specified network partition is notfound
 * @throws RestAPIException
 */
@DELETE @Path("String_Node_Str") @AuthorizationAction("String_Node_Str") public Response removeNetworkPartition(@PathParam("String_Node_Str") String networkPartitionId) throws RestAPIException {
  try {
    PrivilegedCarbonContext carbonContext=PrivilegedCarbonContext.getThreadLocalCarbonContext();
    StratosApiV41Utils.removeNetworkPartition(networkPartitionId,carbonContext.getTenantId());
  }
 catch (  CloudControllerServiceNetworkPartitionNotExistsExceptionException e) {
    return Response.status(Response.Status.NOT_FOUND).entity(new ResponseMessageBean(ResponseMessageBean.ERROR,"String_Node_Str")).build();
  }
  return Response.ok().entity(new ResponseMessageBean(ResponseMessageBean.SUCCESS,String.format("String_Node_Str",networkPartitionId))).build();
}

Fixed version (ground truth):
/** 
 * Remove network partition by network partition id
 * @return 200 if specified network partition is successfully deleted, 404 if specified network partition is notfound
 * @throws RestAPIException
 */
@DELETE @Path("String_Node_Str") @AuthorizationAction("String_Node_Str") public Response removeNetworkPartition(@PathParam("String_Node_Str") String networkPartitionId) throws RestAPIException {
  PrivilegedCarbonContext carbonContext=PrivilegedCarbonContext.getThreadLocalCarbonContext();
  try {
    StratosApiV41Utils.removeNetworkPartition(networkPartitionId,carbonContext.getTenantId());
  }
 catch (  CloudControllerServiceNetworkPartitionNotExistsExceptionException e) {
    return Response.status(Response.Status.NOT_FOUND).entity(new ResponseMessageBean(ResponseMessageBean.ERROR,"String_Node_Str")).build();
  }
  return Response.ok().entity(new ResponseMessageBean(ResponseMessageBean.SUCCESS,String.format("String_Node_Str" + "String_Node_Str",networkPartitionId,carbonContext.getTenantDomain()))).build();
}
Program: 115548
Project: 115548
Buggy source:
/** 
 * Updates a network partition
 * @param networkPartition Network Partition
 * @return 200 if network partition is successfully updated
 * @throws RestAPIException
 */
@PUT @Path("String_Node_Str") @Produces("String_Node_Str") @Consumes("String_Node_Str") @AuthorizationAction("String_Node_Str") public Response updateNetworkPartition(NetworkPartitionBean networkPartition) throws RestAPIException {
  try {
    StratosApiV41Utils.updateNetworkPartition(networkPartition);
  }
 catch (  CloudControllerServiceNetworkPartitionNotExistsExceptionException e) {
    return Response.status(Response.Status.NOT_FOUND).entity(new ResponseMessageBean(ResponseMessageBean.ERROR,"String_Node_Str")).build();
  }
  return Response.ok().entity(new ResponseMessageBean(ResponseMessageBean.SUCCESS,String.format("String_Node_Str",networkPartition.getId()))).build();
}

Fixed version (ground truth):
/** 
 * Updates a network partition
 * @param networkPartition Network Partition
 * @return 200 if network partition is successfully updated
 * @throws RestAPIException
 */
@PUT @Path("String_Node_Str") @Produces("String_Node_Str") @Consumes("String_Node_Str") @AuthorizationAction("String_Node_Str") public Response updateNetworkPartition(NetworkPartitionBean networkPartition) throws RestAPIException {
  try {
    StratosApiV41Utils.updateNetworkPartition(networkPartition);
  }
 catch (  CloudControllerServiceNetworkPartitionNotExistsExceptionException e) {
    return Response.status(Response.Status.NOT_FOUND).entity(new ResponseMessageBean(ResponseMessageBean.ERROR,"String_Node_Str")).build();
  }
  return Response.ok().entity(new ResponseMessageBean(ResponseMessageBean.SUCCESS,String.format("String_Node_Str" + "String_Node_Str",networkPartition.getUuid(),networkPartition.getId()))).build();
}
Program: 115549
Project: 115549
Buggy source:
@Override public boolean addApplicationPolicy(ApplicationPolicy applicationPolicy) throws RemoteException, InvalidApplicationPolicyException, ApplicationPolicyAlreadyExistsException {
  AutoscalerUtil.validateApplicationPolicy(applicationPolicy);
  if (log.isInfoEnabled()) {
    log.info("String_Node_Str" + applicationPolicy.getUuid());
  }
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + applicationPolicy.toString());
  }
  String applicationPolicyUuid=applicationPolicy.getUuid();
  if (PolicyManager.getInstance().getApplicationPolicy(applicationPolicyUuid) != null) {
    String message="String_Node_Str" + applicationPolicyUuid;
    log.error(message);
    throw new ApplicationPolicyAlreadyExistsException(message);
  }
  String applicationPolicyId=applicationPolicy.getId();
  if (PolicyManager.getInstance().getApplicationPolicyById(applicationPolicyId) != null && PolicyManager.getInstance().getApplicationPolicyById(applicationPolicyId).getTenantId() == applicationPolicy.getTenantId()) {
    String message="String_Node_Str" + applicationPolicyId;
    log.error(message);
    throw new ApplicationPolicyAlreadyExistsException(message);
  }
  PolicyManager.getInstance().addApplicationPolicy(applicationPolicy);
  return true;
}

Fixed version (ground truth):
@Override public boolean addApplicationPolicy(ApplicationPolicy applicationPolicy) throws RemoteException, InvalidApplicationPolicyException, ApplicationPolicyAlreadyExistsException {
  AutoscalerUtil.validateApplicationPolicy(applicationPolicy);
  if (log.isInfoEnabled()) {
    log.info("String_Node_Str" + applicationPolicy.getUuid());
  }
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + applicationPolicy.toString());
  }
  String applicationPolicyUuid=applicationPolicy.getUuid();
  if (PolicyManager.getInstance().getApplicationPolicy(applicationPolicyUuid) != null) {
    String message="String_Node_Str" + applicationPolicyUuid;
    log.error(message);
    throw new ApplicationPolicyAlreadyExistsException(message);
  }
  String applicationPolicyUuid1=applicationPolicy.getUuid();
  if (PolicyManager.getInstance().getApplicationPolicyByUuid(applicationPolicyUuid1) != null && PolicyManager.getInstance().getApplicationPolicyByUuid(applicationPolicyUuid1).getTenantId() == applicationPolicy.getTenantId()) {
    String message="String_Node_Str" + applicationPolicyUuid1;
    log.error(message);
    throw new ApplicationPolicyAlreadyExistsException(message);
  }
  PolicyManager.getInstance().addApplicationPolicy(applicationPolicy);
  return true;
}
Program: 115550
Project: 115550
Buggy source:
/** 
 * Validates an application policy against the application
 * @param applicationId
 * @param applicationPolicyId
 * @throws ApplicatioinPolicyNotExistsException
 * @throws InvalidApplicationPolicyException
 */
public static void validateApplicationPolicyAgainstApplication(String applicationId,String applicationPolicyId) throws ApplicatioinPolicyNotExistsException, InvalidApplicationPolicyException {
  ApplicationPolicy applicationPolicy=PolicyManager.getInstance().getApplicationPolicyById(applicationPolicyId);
  if (applicationPolicy == null) {
    String msg=String.format("String_Node_Str",applicationPolicyId);
    log.error(msg);
    throw new ApplicatioinPolicyNotExistsException(msg);
  }
  String[] networkPartitionIds=applicationPolicy.getNetworkPartitionsUuid();
  for (  String applicationPolicyNetworkPartitionerence : networkPartitionIds) {
    String networkPartitionId=applicationPolicyNetworkPartitionerence;
    if (!isAppUsingNetworkPartitionId(applicationId,networkPartitionId)) {
      String msg=String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str",networkPartitionId,applicationId,networkPartitionId,networkPartitionId);
      log.error(msg);
      throw new InvalidApplicationPolicyException(msg);
    }
  }
}

Fixed version (ground truth):
/** 
 * Validates an application policy against the application
 * @param applicationUuid
 * @param applicationPolicyUuid
 * @throws ApplicatioinPolicyNotExistsException
 * @throws InvalidApplicationPolicyException
 */
public static void validateApplicationPolicyAgainstApplication(String applicationUuid,String applicationPolicyUuid) throws ApplicatioinPolicyNotExistsException, InvalidApplicationPolicyException {
  ApplicationPolicy applicationPolicy=PolicyManager.getInstance().getApplicationPolicyByUuid(applicationPolicyUuid);
  if (applicationPolicy == null) {
    String msg=String.format("String_Node_Str",applicationPolicyUuid);
    log.error(msg);
    throw new ApplicatioinPolicyNotExistsException(msg);
  }
  String[] networkPartitionUuids=applicationPolicy.getNetworkPartitionsUuid();
  for (  String applicationPolicyNetworkPartitionreference : networkPartitionUuids) {
    String networkPartitionUuid=applicationPolicyNetworkPartitionreference;
    if (!isAppUsingNetworkPartitionId(applicationUuid,networkPartitionUuid)) {
      String msg=String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str",networkPartitionUuid,applicationUuid,networkPartitionUuid,networkPartitionUuid);
      log.error(msg);
      throw new InvalidApplicationPolicyException(msg);
    }
  }
}
Program: 115551
Project: 115551
Buggy source:
/** 
 * Get deployment policy ids referred in an application.
 * @param applicationId the application id
 * @return list of deployment policy ids
 */
public static List<String> getDeploymentPolicyIdsReferredInApplication(String applicationId){
  if (applicationId == null || StringUtils.isBlank(applicationId)) {
    return null;
  }
  Application application=ApplicationHolder.getApplications().getApplication(applicationId);
  if (application == null) {
    return null;
  }
  Map<String,String> aliasToDeploymentPolicyIdMap=application.getAliasToDeploymentPolicyIdMap();
  if (aliasToDeploymentPolicyIdMap == null) {
    return null;
  }
  List<String> deploymentPolicyIds=new ArrayList<String>();
  for (  Map.Entry<String,String> entry : aliasToDeploymentPolicyIdMap.entrySet()) {
    if (!deploymentPolicyIds.contains(entry.getValue())) {
      deploymentPolicyIds.add(entry.getValue());
    }
  }
  return deploymentPolicyIds;
}

Fixed version (ground truth):
/** 
 * Get deployment policy ids referred in an application.
 * @param applicationUuid the application uuid
 * @return list of deployment policy ids
 */
public static List<String> getDeploymentPolicyIdsReferredInApplication(String applicationUuid){
  if (applicationUuid == null || StringUtils.isBlank(applicationUuid)) {
    return null;
  }
  Application application=ApplicationHolder.getApplications().getApplication(applicationUuid);
  if (application == null) {
    return null;
  }
  Map<String,String> aliasToDeploymentPolicyIdMap=application.getAliasToDeploymentPolicyIdMap();
  if (aliasToDeploymentPolicyIdMap == null) {
    return null;
  }
  List<String> deploymentPolicyIds=new ArrayList<String>();
  for (  Map.Entry<String,String> entry : aliasToDeploymentPolicyIdMap.entrySet()) {
    if (!deploymentPolicyIds.contains(entry.getValue())) {
      deploymentPolicyIds.add(entry.getValue());
    }
  }
  return deploymentPolicyIds;
}
Program: 115553
Project: 115553
Buggy source:
private static void getAliasToDeployloymentPolicyIdMapFromChildGroupContexts(Map<String,String> aliasToDeploymentPolicyIdMap,GroupContext[] groupContexts){
  if (groupContexts != null && groupContexts.length != 0) {
    for (    GroupContext groupContext : groupContexts) {
      if (groupContext != null) {
        if (groupContext.getDeploymentPolicy() == null || groupContext.getDeploymentPolicy().isEmpty()) {
          getAliasToDeployloymentPolicyIdMapFromChildCartridgeContexts(aliasToDeploymentPolicyIdMap,groupContext.getCartridgeContexts());
          getAliasToDeployloymentPolicyIdMapFromChildGroupContexts(aliasToDeploymentPolicyIdMap,groupContext.getGroupContexts());
        }
 else {
          String deploymentPolicyId=groupContext.getDeploymentPolicy();
          aliasToDeploymentPolicyIdMap.put(groupContext.getAlias(),deploymentPolicyId);
          if (groupContext.getCartridgeContexts() != null && groupContext.getCartridgeContexts().length != 0) {
            setDeploymentPolicyIdToChildCartridgeContexts(aliasToDeploymentPolicyIdMap,deploymentPolicyId,groupContext.getCartridgeContexts());
          }
          if (groupContext.getGroupContexts() != null && groupContext.getGroupContexts().length != 0) {
            setDeploymentPolicyIdToChildGroupContexts(aliasToDeploymentPolicyIdMap,deploymentPolicyId,groupContext.getGroupContexts());
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private static void getAliasToDeployloymentPolicyIdMapFromChildGroupContexts(Map<String,String> aliasToDeploymentPolicyIdMap,GroupContext[] groupContexts){
  if (groupContexts != null && groupContexts.length != 0) {
    for (    GroupContext groupContext : groupContexts) {
      if (groupContext != null) {
        if (groupContext.getDeploymentPolicy() == null || groupContext.getDeploymentPolicy().isEmpty()) {
          getAliasToDeployloymentPolicyIdMapFromChildCartridgeContexts(aliasToDeploymentPolicyIdMap,groupContext.getCartridgeContexts());
          getAliasToDeployloymentPolicyIdMapFromChildGroupContexts(aliasToDeploymentPolicyIdMap,groupContext.getGroupContexts());
        }
 else {
          String deploymentPolicyUuid=groupContext.getDeploymentPolicyUuid();
          aliasToDeploymentPolicyIdMap.put(groupContext.getAlias(),deploymentPolicyUuid);
          if (groupContext.getCartridgeContexts() != null && groupContext.getCartridgeContexts().length != 0) {
            setDeploymentPolicyIdToChildCartridgeContexts(aliasToDeploymentPolicyIdMap,deploymentPolicyUuid,groupContext.getCartridgeContexts());
          }
          if (groupContext.getGroupContexts() != null && groupContext.getGroupContexts().length != 0) {
            setDeploymentPolicyIdToChildGroupContexts(aliasToDeploymentPolicyIdMap,deploymentPolicyUuid,groupContext.getGroupContexts());
          }
        }
      }
    }
  }
}
Program: 115554
Project: 115554
Buggy source:
private static org.apache.stratos.autoscaler.stub.pojo.GroupContext[] convertGroupDefinitionsToStubGroupContexts(List<CartridgeGroupReferenceBean> groupDefinitions,int tenantId) throws RestAPIException {
  if (groupDefinitions == null) {
    return null;
  }
  GroupContext[] groupContexts=new GroupContext[groupDefinitions.size()];
  int i=0;
  for (  CartridgeGroupReferenceBean groupDefinition : groupDefinitions) {
    GroupContext groupContext=new GroupContext();
    groupContext.setUuid(StratosApiV41Utils.getServiceGroupUuidByTenant(groupDefinition.getName(),tenantId));
    groupDefinition.setTenantId(tenantId);
    groupContext.setName(groupDefinition.getName());
    groupContext.setAlias(groupDefinition.getAlias());
    groupContext.setGroupMaxInstances(groupDefinition.getGroupMaxInstances());
    groupContext.setGroupMinInstances(groupDefinition.getGroupMinInstances());
    groupContext.setDeploymentPolicy(groupDefinition.getDeploymentPolicy());
    if (groupDefinition.getGroups() != null) {
      groupContext.setGroupContexts(convertGroupDefinitionsToStubGroupContexts(groupDefinition.getGroups(),tenantId));
    }
    if (groupDefinition.getCartridges() != null) {
      groupContext.setCartridgeContexts(convertCartridgeReferenceBeansToStubCartridgeContexts(groupDefinition.getCartridges(),-1234));
    }
    groupContexts[i++]=groupContext;
  }
  return groupContexts;
}

Fixed version (ground truth):
private static org.apache.stratos.autoscaler.stub.pojo.GroupContext[] convertGroupDefinitionsToStubGroupContexts(List<CartridgeGroupReferenceBean> groupDefinitions,int tenantId) throws RestAPIException {
  if (groupDefinitions == null) {
    return null;
  }
  GroupContext[] groupContexts=new GroupContext[groupDefinitions.size()];
  int i=0;
  for (  CartridgeGroupReferenceBean groupDefinition : groupDefinitions) {
    GroupContext groupContext=new GroupContext();
    groupContext.setUuid(StratosApiV41Utils.getServiceGroupUuidByTenant(groupDefinition.getName(),tenantId));
    groupDefinition.setTenantId(tenantId);
    groupContext.setName(groupDefinition.getName());
    groupContext.setAlias(groupDefinition.getAlias());
    groupContext.setGroupMaxInstances(groupDefinition.getGroupMaxInstances());
    groupContext.setGroupMinInstances(groupDefinition.getGroupMinInstances());
    groupContext.setDeploymentPolicy(groupDefinition.getDeploymentPolicy());
    groupContext.setDeploymentPolicyUuid(groupDefinition.getUuid());
    if (groupDefinition.getGroups() != null) {
      groupContext.setGroupContexts(convertGroupDefinitionsToStubGroupContexts(groupDefinition.getGroups(),tenantId));
    }
    if (groupDefinition.getCartridges() != null) {
      groupContext.setCartridgeContexts(convertCartridgeReferenceBeansToStubCartridgeContexts(groupDefinition.getCartridges(),-1234));
    }
    groupContexts[i++]=groupContext;
  }
  return groupContexts;
}
Program: 115555
Project: 115555
Buggy source:
public void updateCartridge(Cartridge cartridge){
  cartridgeTypeToCartridgeMap.put(cartridge.getType(),cartridge);
}

Fixed version (ground truth):
public void updateCartridge(Cartridge cartridge){
  cartridgeTypeToCartridgeMap.put(cartridge.getUuid(),cartridge);
}
Program: 115556
Project: 115556
Buggy source:
public void removeCartridge(Cartridge cartridge){
  if (cartridgeTypeToCartridgeMap.containsKey(cartridge.getType())) {
    cartridgeTypeToCartridgeMap.remove(cartridge.getType());
  }
}

Fixed version (ground truth):
public void removeCartridge(Cartridge cartridge){
  if (cartridgeTypeToCartridgeMap.containsKey(cartridge.getUuid())) {
    cartridgeTypeToCartridgeMap.remove(cartridge.getUuid());
  }
}
Program: 115558
Project: 115558
Buggy source:
/** 
 * Get deployment policy by deployment policy id
 * @param deploymentPolicyId deployment policy id
 * @return {@link DeploymentPolicyBean}
 */
public static DeploymentPolicyBean getDeploymentPolicy(String deploymentPolicyId) throws RestAPIException {
  DeploymentPolicyBean deploymentPolicyBean;
  try {
    org.apache.stratos.autoscaler.stub.deployment.policy.DeploymentPolicy[] deploymentPolicies=AutoscalerServiceClient.getInstance().getDeploymentPolicies();
    DeploymentPolicy deploymentPolicy=null;
    PrivilegedCarbonContext carbonContext=PrivilegedCarbonContext.getThreadLocalCarbonContext();
    for (    DeploymentPolicy deploymentPolicy1 : deploymentPolicies) {
      if (carbonContext.getTenantId() == deploymentPolicy1.getTenantId()) {
        if (deploymentPolicy1.getId().equals(deploymentPolicyId)) {
          deploymentPolicy=deploymentPolicy1;
        }
      }
    }
    if (deploymentPolicy == null) {
      return null;
    }
    deploymentPolicyBean=ObjectConverter.convertCCStubDeploymentPolicyToDeploymentPolicy(deploymentPolicy);
  }
 catch (  RemoteException e) {
    String msg="String_Node_Str" + deploymentPolicyId;
    log.error(msg,e);
    throw new RestAPIException(msg);
  }
  return deploymentPolicyBean;
}

Fixed version (ground truth):
/** 
 * Get deployment policy by deployment policy id
 * @param deploymentPolicyId deployment policy id
 * @return {@link DeploymentPolicyBean}
 */
public static DeploymentPolicyBean getDeploymentPolicy(String deploymentPolicyId) throws RestAPIException {
  DeploymentPolicyBean deploymentPolicyBean;
  try {
    PrivilegedCarbonContext carbonContext=PrivilegedCarbonContext.getThreadLocalCarbonContext();
    org.apache.stratos.autoscaler.stub.deployment.policy.DeploymentPolicy deploymentPolicy=AutoscalerServiceClient.getInstance().getDeploymentPolicyForTenant(deploymentPolicyId,carbonContext.getTenantId());
    if (deploymentPolicy == null) {
      return null;
    }
    deploymentPolicyBean=ObjectConverter.convertCCStubDeploymentPolicyToDeploymentPolicy(deploymentPolicy);
  }
 catch (  RemoteException e) {
    String msg="String_Node_Str" + deploymentPolicyId;
    log.error(msg,e);
    throw new RestAPIException(msg);
  }
  return deploymentPolicyBean;
}
Program: 115559
Project: 115559
Buggy source:
/** 
 * Get deployment policies
 * @return array of {@link DeploymentPolicyBean}
 */
public static DeploymentPolicyBean[] getDeploymentPolicies() throws RestAPIException {
  try {
    org.apache.stratos.autoscaler.stub.deployment.policy.DeploymentPolicy[] deploymentPolicies=AutoscalerServiceClient.getInstance().getDeploymentPolicies();
    DeploymentPolicy[] deploymentPoliciesForTenantArray=new DeploymentPolicy[0];
    if (deploymentPolicies != null) {
      PrivilegedCarbonContext carbonContext=PrivilegedCarbonContext.getThreadLocalCarbonContext();
      List<DeploymentPolicy> deploymentPoliciesForTenant=new ArrayList<DeploymentPolicy>();
      for (      DeploymentPolicy deploymentPolicy : deploymentPolicies) {
        if (carbonContext.getTenantId() == deploymentPolicy.getTenantId()) {
          deploymentPoliciesForTenant.add(deploymentPolicy);
        }
      }
      if (deploymentPoliciesForTenant.size() != 0) {
        deploymentPoliciesForTenantArray=deploymentPoliciesForTenant.toArray(new DeploymentPolicy[deploymentPoliciesForTenant.size()]);
      }
    }
    return ObjectConverter.convertASStubDeploymentPoliciesToDeploymentPolicies(deploymentPoliciesForTenantArray);
  }
 catch (  RemoteException e) {
    String message="String_Node_Str";
    log.error(message);
    throw new RestAPIException(message,e);
  }
}

Fixed version (ground truth):
/** 
 * Get deployment policies
 * @return array of {@link DeploymentPolicyBean}
 */
public static DeploymentPolicyBean[] getDeploymentPolicies() throws RestAPIException {
  try {
    PrivilegedCarbonContext carbonContext=PrivilegedCarbonContext.getThreadLocalCarbonContext();
    org.apache.stratos.autoscaler.stub.deployment.policy.DeploymentPolicy[] deploymentPolicies=AutoscalerServiceClient.getInstance().getDeploymentPoliciesByTenant(carbonContext.getTenantId());
    return ObjectConverter.convertASStubDeploymentPoliciesToDeploymentPolicies(deploymentPolicies);
  }
 catch (  RemoteException e) {
    String message="String_Node_Str";
    log.error(message);
    throw new RestAPIException(message,e);
  }
}
Program: 115561
Project: 115561
Buggy source:
/** 
 * Retrieves deployed service group
 * @param serviceGroupName name of the Service Group
 * @return ServiceGroup instance if exists
 * @throws ApplicationDefinitionException if no Service Group found for the given serviceGroupName
 */
private ServiceGroup getServiceGroup(String serviceGroupName) throws ApplicationDefinitionException {
  try {
    return RegistryManager.getInstance().getServiceGroup(serviceGroupName);
  }
 catch (  Exception e) {
    String errorMsg="String_Node_Str" + serviceGroupName;
    log.error(errorMsg,e);
    throw new ApplicationDefinitionException(errorMsg,e);
  }
}

Fixed version (ground truth):
/** 
 * Retrieves deployed service group
 * @param serviceGroupUuid Service Group uuid
 * @return ServiceGroup instance if exists
 * @throws ApplicationDefinitionException if no Service Group found for the given serviceGroupName
 */
private ServiceGroup getServiceGroup(String serviceGroupUuid) throws ApplicationDefinitionException {
  try {
    return RegistryManager.getInstance().getServiceGroup(serviceGroupUuid);
  }
 catch (  Exception e) {
    String errorMsg="String_Node_Str" + serviceGroupUuid;
    log.error(errorMsg,e);
    throw new ApplicationDefinitionException(errorMsg,e);
  }
}
Program: 115562
Project: 115562
Buggy source:
/** 
 * Find the scale dependent order
 * @param serviceGroup GroupContext with Group defintion information
 * @return Set of Startup Orders which are defined in the Group
 * @throws ApplicationDefinitionException
 */
private String[] getScaleDependentForGroup(String serviceGroupName,ServiceGroup serviceGroup) throws ApplicationDefinitionException {
}

Fixed version (ground truth):
/** 
 * Find the scale dependent order
 * @param serviceGroup GroupContext with Group defintion information
 * @return Set of Startup Orders which are defined in the Group
 * @throws ApplicationDefinitionException
 */
private String[] getScaleDependentForGroup(String serviceGroupUuid,ServiceGroup serviceGroup) throws ApplicationDefinitionException {
}
Program: 115563
Project: 115563
Buggy source:
/** 
 * Parse Group information
 * @param appId                   Application id
 * @param tenantId                tenant id of tenant which deployed the Application
 * @param key                     Generated key for the Application
 * @param groupCtxts              Group information
 * @param subscribableInformation Subscribable Information
 * @return Map [alias -> Group]
 * @throws ApplicationDefinitionException if an error occurs in parsing Group Information
 */
private Map<String,Group> parseGroups(String appId,int tenantId,String key,List<GroupContext> groupCtxts,Map<String,SubscribableInfoContext> subscribableInformation) throws ApplicationDefinitionException, CartridgeGroupNotFoundException, CartridgeNotFoundException {
  Map<String,Group> groupAliasToGroup=new HashMap<String,Group>();
  for (  GroupContext groupCtxt : groupCtxts) {
    ServiceGroup serviceGroup=getServiceGroup(groupCtxt.getName());
    if (serviceGroup == null) {
      log.error("String_Node_Str" + groupCtxt.getName());
      throw new CartridgeGroupNotFoundException("String_Node_Str" + groupCtxt.getName());
    }
    Group group=parseGroup(appId,tenantId,key,groupCtxt,subscribableInformation,serviceGroup);
    validateCartridgeGroupReference(appId,serviceGroup,group);
    groupAliasToGroup.put(group.getAlias(),group);
  }
  Set<Group> nestedGroups=new HashSet<Group>();
  getNestedGroupContexts(nestedGroups,groupAliasToGroup.values());
  filterDuplicatedGroupContexts(groupAliasToGroup.values(),nestedGroups);
  return groupAliasToGroup;
}

Fixed version (ground truth):
/** 
 * Parse Group information
 * @param appId                   Application id
 * @param tenantId                tenant id of tenant which deployed the Application
 * @param key                     Generated key for the Application
 * @param groupCtxts              Group information
 * @param subscribableInformation Subscribable Information
 * @return Map [alias -> Group]
 * @throws ApplicationDefinitionException if an error occurs in parsing Group Information
 */
private Map<String,Group> parseGroups(String appId,int tenantId,String key,List<GroupContext> groupCtxts,Map<String,SubscribableInfoContext> subscribableInformation) throws ApplicationDefinitionException, CartridgeGroupNotFoundException, CartridgeNotFoundException {
  Map<String,Group> groupAliasToGroup=new HashMap<String,Group>();
  for (  GroupContext groupCtxt : groupCtxts) {
    ServiceGroup serviceGroup=getServiceGroup(groupCtxt.getUuid());
    if (serviceGroup == null) {
      log.error("String_Node_Str" + groupCtxt.getName());
      throw new CartridgeGroupNotFoundException("String_Node_Str" + groupCtxt.getName());
    }
    Group group=parseGroup(appId,tenantId,key,groupCtxt,subscribableInformation,serviceGroup);
    validateCartridgeGroupReference(appId,serviceGroup,group);
    groupAliasToGroup.put(group.getAlias(),group);
  }
  Set<Group> nestedGroups=new HashSet<Group>();
  getNestedGroupContexts(nestedGroups,groupAliasToGroup.values());
  filterDuplicatedGroupContexts(groupAliasToGroup.values(),nestedGroups);
  return groupAliasToGroup;
}
Program: 115564
Project: 115564
Buggy source:
private Cartridge getCartridge(String cartridgeType) throws ApplicationDefinitionException {
  try {
    return CloudControllerServiceClient.getInstance().getCartridge(cartridgeType);
  }
 catch (  Exception e) {
    log.error("String_Node_Str" + cartridgeType,e);
    throw new ApplicationDefinitionException(e);
  }
}

Fixed version (ground truth):
private Cartridge getCartridge(String cartridgeUuid) throws ApplicationDefinitionException {
  try {
    return CloudControllerServiceClient.getInstance().getCartridge(cartridgeUuid);
  }
 catch (  Exception e) {
    log.error("String_Node_Str" + cartridgeUuid,e);
    throw new ApplicationDefinitionException(e);
  }
}
Program: 115566
Project: 115566
Buggy source:
private ServiceGroup getNestedServiceGroup(String serviceGroupName,ServiceGroup serviceGroup){
  if (serviceGroup.getUuid().equals(serviceGroupName)) {
    return serviceGroup;
  }
 else   if (serviceGroup.getGroups() != null) {
    ServiceGroup[] groups=serviceGroup.getGroups();
    for (    ServiceGroup sg : groups) {
      return getNestedServiceGroup(serviceGroupName,sg);
    }
  }
  return null;
}

Fixed version (ground truth):
private ServiceGroup getNestedServiceGroup(String serviceGroupUuid,ServiceGroup serviceGroup){
  if (serviceGroup.getUuid().equals(serviceGroupUuid)) {
    return serviceGroup;
  }
 else   if (serviceGroup.getGroups() != null) {
    ServiceGroup[] groups=serviceGroup.getGroups();
    for (    ServiceGroup sg : groups) {
      return getNestedServiceGroup(serviceGroupUuid,sg);
    }
  }
  return null;
}
Program: 115567
Project: 115567
Buggy source:
/** 
 * Get kill behaviour related to a Group
 * @param serviceGroupName Group name
 * @return String indicating the kill behavior
 * @throws ApplicationDefinitionException if an error occurs
 */
private String getTerminationBehaviour(String serviceGroupName,ServiceGroup serviceGroup) throws ApplicationDefinitionException {
}

Fixed version (ground truth):
/** 
 * Get kill behaviour related to a Group
 * @param serviceGroupUuid Group Uuid
 * @return String indicating the kill behavior
 * @throws ApplicationDefinitionException if an error occurs
 */
private String getTerminationBehaviour(String serviceGroupUuid,ServiceGroup serviceGroup) throws ApplicationDefinitionException {
}
Program: 115568
Project: 115568
Buggy source:
/** 
 * Find the startup order
 * @param serviceGroup GroupContext with Group defintion information
 * @return Set of Startup Orders which are defined in the Group
 * @throws ApplicationDefinitionException
 */
private String[] getStartupOrderForGroup(String serviceGroupName,ServiceGroup serviceGroup) throws ApplicationDefinitionException {
}

Fixed version (ground truth):
/** 
 * Find the startup order
 * @param serviceGroup GroupContext with Group defintion information
 * @param serviceGroupUuid Group Uuid
 * @return Set of Startup Orders which are defined in the Group
 * @throws ApplicationDefinitionException
 */
private String[] getStartupOrderForGroup(String serviceGroupUuid,ServiceGroup serviceGroup) throws ApplicationDefinitionException {
}
Program: 115570
Project: 115570
Buggy source:
@Override public Cartridge getCartridgeByTenant(String cartridgeType,int tenantId) throws CartridgeNotFoundException {
  Collection<Cartridge> cartridges=CloudControllerContext.getInstance().getCartridges();
  if (cartridges == null) {
    log.info("String_Node_Str");
    return null;
  }
  for (  Cartridge cartridge : cartridges) {
    if (log.isDebugEnabled()) {
      log.debug(cartridge);
    }
    if (cartridge.getType().equals(cartridgeType) && (cartridge.getTenantId() == tenantId)) {
      return cartridge;
    }
  }
  String msg="String_Node_Str" + cartridgeType + tenantId;
  throw new CartridgeNotFoundException(msg);
}

Fixed version (ground truth):
@Override public Cartridge getCartridgeByTenant(String cartridgeType,int tenantId) throws CartridgeNotFoundException {
  Collection<Cartridge> cartridges=CloudControllerContext.getInstance().getCartridges();
  if (cartridges == null || cartridges.size() == 0) {
    log.info("String_Node_Str");
    return null;
  }
  for (  Cartridge cartridge : cartridges) {
    if (log.isDebugEnabled()) {
      log.debug(cartridge);
    }
    if (cartridge.getType().equals(cartridgeType) && (cartridge.getTenantId() == tenantId)) {
      return cartridge;
    }
  }
  String msg="String_Node_Str" + cartridgeType + tenantId;
  throw new CartridgeNotFoundException(msg);
}
Program: 115571
Project: 115571
Buggy source:
/** 
 * Adds the used cartridges in cartridge groups to cache.
 * @param cartridgeGroupUuid the cartridge group UUID
 * @param cartridgeNames     the cartridge names
 * @throws RemoteException the remote exception
 */
public void addUsedCartridgesInCartridgeGroups(String cartridgeGroupUuid,String[] cartridgeNames) throws RemoteException {
  stub.addUsedCartridgesInCartridgeGroups(cartridgeGroupUuid,cartridgeNames);
}

Fixed version (ground truth):
/** 
 * Adds the used cartridges in cartridge groups to cache.
 * @param cartridgeGroupUuid the cartridge group uuid
 * @param cartridgeUuids     the cartridge uuids
 * @throws RemoteException the remote exception
 */
public void addUsedCartridgesInCartridgeGroups(String cartridgeGroupUuid,String[] cartridgeUuids) throws RemoteException {
  stub.addUsedCartridgesInCartridgeGroups(cartridgeGroupUuid,cartridgeUuids);
}
Program: 115572
Project: 115572
Buggy source:
public void addUsedCartridgesInCartridgeGroups(String cartridgeGroupNameUuid,String[] cartridgeNamesUuid){
  if (cartridgeNamesUuid == null) {
    return;
  }
  for (  String cartridgeNameUuid : cartridgeNamesUuid) {
    Set<String> cartridgeGroupNames=null;
    if (cartridgeTypeToCartridgeGroupsMap.containsKey(cartridgeNameUuid)) {
      cartridgeGroupNames=cartridgeTypeToCartridgeGroupsMap.get(cartridgeNameUuid);
    }
 else {
      cartridgeGroupNames=new HashSet<String>();
      cartridgeTypeToCartridgeGroupsMap.put(cartridgeNameUuid,cartridgeGroupNames);
    }
    cartridgeGroupNames.add(cartridgeGroupNameUuid);
  }
}

Fixed version (ground truth):
public void addUsedCartridgesInCartridgeGroups(String cartridgeGroupUuid,String[] cartridgeUuids){
  if (cartridgeUuids == null) {
    return;
  }
  for (  String cartridgeNameUuid : cartridgeUuids) {
    Set<String> cartridgeGroupNames=null;
    if (cartridgeTypeToCartridgeGroupsMap.containsKey(cartridgeNameUuid)) {
      cartridgeGroupNames=cartridgeTypeToCartridgeGroupsMap.get(cartridgeNameUuid);
    }
 else {
      cartridgeGroupNames=new HashSet<String>();
      cartridgeTypeToCartridgeGroupsMap.put(cartridgeNameUuid,cartridgeGroupNames);
    }
    cartridgeGroupNames.add(cartridgeGroupUuid);
  }
}
Program: 115574
Project: 115574
Buggy source:
private static org.apache.stratos.autoscaler.stub.pojo.GroupContext[] convertGroupDefinitionsToStubGroupContexts(List<CartridgeGroupReferenceBean> groupDefinitions,int tenantId) throws RestAPIException {
  if (groupDefinitions == null) {
    return null;
  }
  GroupContext[] groupContexts=new GroupContext[groupDefinitions.size()];
  int i=0;
  for (  CartridgeGroupReferenceBean groupDefinition : groupDefinitions) {
    GroupContext groupContext=new GroupContext();
    groupContext.setUuid(StratosApiV41Utils.getServiceGroupUuidByTenant(groupDefinition.getName(),tenantId));
    groupDefinition.setTenantId(tenantId);
    groupContext.setName(groupDefinition.getName());
    groupContext.setAlias(groupDefinition.getAlias());
    groupContext.setGroupMaxInstances(groupDefinition.getGroupMaxInstances());
    groupContext.setGroupMinInstances(groupDefinition.getGroupMinInstances());
    groupContext.setDeploymentPolicy(groupDefinition.getDeploymentPolicy());
    groupContext.setDeploymentPolicyUuid(groupDefinition.getUuid());
    if (groupDefinition.getGroups() != null) {
      groupContext.setGroupContexts(convertGroupDefinitionsToStubGroupContexts(groupDefinition.getGroups(),tenantId));
    }
    if (groupDefinition.getCartridges() != null) {
      groupContext.setCartridgeContexts(convertCartridgeReferenceBeansToStubCartridgeContexts(groupDefinition.getCartridges(),-1234));
    }
    groupContexts[i++]=groupContext;
  }
  return groupContexts;
}

Fixed version (ground truth):
private static org.apache.stratos.autoscaler.stub.pojo.GroupContext[] convertGroupDefinitionsToStubGroupContexts(List<CartridgeGroupReferenceBean> groupDefinitions,int tenantId) throws RestAPIException {
  if (groupDefinitions == null) {
    return null;
  }
  GroupContext[] groupContexts=new GroupContext[groupDefinitions.size()];
  int i=0;
  for (  CartridgeGroupReferenceBean groupDefinition : groupDefinitions) {
    GroupContext groupContext=new GroupContext();
    groupContext.setUuid(StratosApiV41Utils.getServiceGroupUuidByTenant(groupDefinition.getName(),tenantId));
    groupDefinition.setTenantId(tenantId);
    groupContext.setName(groupDefinition.getName());
    groupContext.setAlias(groupDefinition.getAlias());
    groupContext.setGroupMaxInstances(groupDefinition.getGroupMaxInstances());
    groupContext.setGroupMinInstances(groupDefinition.getGroupMinInstances());
    groupContext.setDeploymentPolicy(groupDefinition.getDeploymentPolicy());
    groupContext.setDeploymentPolicyUuid(StratosApiV41Utils.getDeploymentPolicyUuidByTenant(groupDefinition.getDeploymentPolicy(),tenantId));
    if (groupDefinition.getGroups() != null) {
      groupContext.setGroupContexts(convertGroupDefinitionsToStubGroupContexts(groupDefinition.getGroups(),tenantId));
    }
    if (groupDefinition.getCartridges() != null) {
      groupContext.setCartridgeContexts(convertCartridgeReferenceBeansToStubCartridgeContexts(groupDefinition.getCartridges(),-1234));
    }
    groupContexts[i++]=groupContext;
  }
  return groupContexts;
}
Program: 115575
Project: 115575
Buggy source:
private org.apache.stratos.load.balancer.common.domain.Service transformService(Service messagingService){
  org.apache.stratos.load.balancer.common.domain.Service service=new org.apache.stratos.load.balancer.common.domain.Service(messagingService.getServiceName());
  if (messagingService.getPorts().size() > 0) {
    for (    Port messagingPort : messagingService.getPorts()) {
      service.addPort(transformPort(messagingPort));
    }
  }
  return service;
}

Fixed version (ground truth):
private org.apache.stratos.load.balancer.common.domain.Service transformService(Service messagingService){
  org.apache.stratos.load.balancer.common.domain.Service service=new org.apache.stratos.load.balancer.common.domain.Service(messagingService.getServiceName());
  return service;
}
Program: 115576
Project: 115576
Buggy source:
/** 
 * To start the dependency of the given application contexts
 * @param applicationContexts the found applicationContexts to be started
 * @param parentInstanceIds   the instance-ids of the parent instance
 */
private boolean startDependency(List<ApplicationChildContext> applicationContexts,List<String> parentInstanceIds){
  if (applicationContexts == null || applicationContexts.isEmpty()) {
    log.info("String_Node_Str" + getMonitorType().toString().toLowerCase() + "String_Node_Str"+ this.id);
    return false;
  }
 else {
    for (    ApplicationChildContext context : applicationContexts) {
      if (!this.aliasToActiveChildMonitorsMap.containsKey(context.getId())) {
        log.info(String.format("String_Node_Str",getAppId(),context.getId()));
        startMonitor(this,context,parentInstanceIds);
      }
 else {
        log.info(String.format("String_Node_Str" + "String_Node_Str",getAppId(),context.getId()));
        Monitor monitor=aliasToActiveChildMonitorsMap.get(context.getId());
        for (        String instanceId : parentInstanceIds) {
          if (monitor.getInstancesByParentInstanceId(instanceId) == null) {
            monitor.createInstanceOnDemand(instanceId);
          }
 else {
            log.info(String.format("String_Node_Str" + "String_Node_Str",getAppId(),context.getId()));
          }
        }
      }
    }
    return true;
  }
}

Fixed version (ground truth):
/** 
 * To start the dependency of the given application contexts
 * @param applicationContexts the found applicationContexts to be started
 * @param parentInstanceIds   the instance-ids of the parent instance
 */
private boolean startDependency(List<ApplicationChildContext> applicationContexts,List<String> parentInstanceIds){
  if (applicationContexts == null || applicationContexts.isEmpty()) {
    log.info("String_Node_Str" + getMonitorType().toString().toLowerCase() + "String_Node_Str"+ this.id);
    return false;
  }
 else {
    for (    ApplicationChildContext context : applicationContexts) {
      if (!this.aliasToActiveChildMonitorsMap.containsKey(context.getId())) {
        log.info(String.format("String_Node_Str",getAppId(),context.getId()));
        startMonitor(this,context,parentInstanceIds);
      }
 else {
        log.info(String.format("String_Node_Str" + "String_Node_Str",getAppId(),context.getId()));
        Monitor monitor=aliasToActiveChildMonitorsMap.get(context.getId());
        for (        String instanceId : parentInstanceIds) {
          if (monitor.getInstancesByParentInstanceId(instanceId) == null || monitor.getInstancesByParentInstanceId(instanceId).isEmpty()) {
            monitor.createInstanceOnDemand(instanceId);
          }
 else {
            log.info(String.format("String_Node_Str" + "String_Node_Str",getAppId(),context.getId(),instanceId));
          }
        }
      }
    }
    return true;
  }
}
Program: 115578
Project: 115578
Buggy source:
public final void testMemberContextOperations() throws Exception {
  AxisConfiguration axisConfiguration=new AxisConfiguration();
  axisConfiguration.setClusteringAgent(null);
  ServiceReferenceHolder.getInstance().setDistributedObjectProvider(new HazelcastDistributedObjectProvider());
  ServiceReferenceHolder.getInstance().setAxisConfiguration(axisConfiguration);
  CloudControllerContext cloudControllerContext=CloudControllerContext.getInstance();
  Thread t1=new Thread(new MemberAdder(cloudControllerContext));
  t1.start();
  t1.join();
  assertEquals(2,cloudControllerContext.getMemberContextsOfClusterId("String_Node_Str").size());
  Thread t2=new Thread(new MemberRemover(cloudControllerContext));
  t2.start();
  t2.join();
  assertEquals(1,cloudControllerContext.getMemberContextsOfClusterId("String_Node_Str").size());
}

Fixed version (ground truth):
public final void testMemberContextOperations() throws Exception {
  AxisConfiguration axisConfiguration=new AxisConfiguration();
  axisConfiguration.setClusteringAgent(null);
  ServiceReferenceHolder.getInstance().setDistributedObjectProvider(new HazelcastDistributedObjectProvider());
  ServiceReferenceHolder.getInstance().setAxisConfiguration(axisConfiguration);
  CloudControllerContext.unitTest=true;
  CloudControllerContext cloudControllerContext=CloudControllerContext.getInstance();
  Thread t1=new Thread(new MemberAdder(cloudControllerContext));
  t1.start();
  t1.join();
  assertEquals(2,cloudControllerContext.getMemberContextsOfClusterId("String_Node_Str").size());
  Thread t2=new Thread(new MemberRemover(cloudControllerContext));
  t2.start();
  t2.join();
  assertEquals(1,cloudControllerContext.getMemberContextsOfClusterId("String_Node_Str").size());
}
Program: 115582
Project: 115582
Buggy source:
public void run(){
  ClusterInstanceContext instanceContext=(ClusterInstanceContext)getAllNetworkPartitionCtxts().get(networkPartitionId).getInstanceContext(instanceId);
  boolean allMovedToObsolete=true;
  for (  ClusterLevelPartitionContext partitionContext : instanceContext.getPartitionCtxts()) {
    if (log.isInfoEnabled()) {
      log.info("String_Node_Str" + getClusterId() + "String_Node_Str"+ "String_Node_Str"+ instanceContext.getNetworkPartitionId()+ "String_Node_Str"+ partitionContext.getPartitionId()+ "String_Node_Str");
    }
    if (AutoscalerContext.getInstance().getAppMonitor(getAppId()).isForce()) {
      log.info(String.format("String_Node_Str",partitionContext.getPartitionId(),getAppId()));
      partitionContext.terminateAllRemainingInstances();
    }
    Iterator<MemberContext> pendingIterator=partitionContext.getPendingMembers().listIterator();
    List<String> pendingMemberIdList=new ArrayList<String>();
    while (pendingIterator.hasNext()) {
      MemberContext pendingMemberContext=pendingIterator.next();
      pendingMemberIdList.add(pendingMemberContext.getMemberId());
    }
    for (    String memberId : pendingMemberIdList) {
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + memberId + "String_Node_Str");
      }
      partitionContext.movePendingMemberToObsoleteMembers(memberId);
    }
    allMovedToObsolete=partitionContext.getTotalMemberCount() == 0;
  }
  if (allMovedToObsolete) {
    monitor.monitor();
  }
}

Fixed version (ground truth):
public void run(){
  NetworkPartitionContext networkPartitionContext=getAllNetworkPartitionCtxts().get(networkPartitionId);
  ClusterInstanceContext instanceContext=(ClusterInstanceContext)networkPartitionContext.getInstanceContext(instanceId);
  if (instanceContext != null) {
    for (    ClusterLevelPartitionContext partitionContext : instanceContext.getPartitionCtxts()) {
      if (log.isInfoEnabled()) {
        log.info("String_Node_Str" + getClusterId() + "String_Node_Str"+ "String_Node_Str"+ instanceContext.getNetworkPartitionId()+ "String_Node_Str"+ partitionContext.getPartitionId()+ "String_Node_Str");
      }
      Iterator<MemberContext> activeIterator=partitionContext.getActiveMembers().listIterator();
      List<String> activeMemberIdList=new ArrayList<String>();
      while (activeIterator.hasNext()) {
        MemberContext activeMemberContext=activeIterator.next();
        activeMemberIdList.add(activeMemberContext.getMemberId());
      }
      for (      String memberId : activeMemberIdList) {
        if (log.isDebugEnabled()) {
          log.debug("String_Node_Str" + memberId + "String_Node_Str");
        }
        partitionContext.moveActiveMemberToTerminationPendingMembers(memberId);
        if (partitionContext.getMemberStatsContext(memberId) != null) {
          partitionContext.removeMemberStatsContext(memberId);
        }
        if (log.isDebugEnabled()) {
          log.debug(String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str",memberId));
        }
      }
    }
  }
}
Program: 115586
Project: 115586
Buggy source:
/** 
 * To start the dependency of the given application contexts
 * @param applicationContexts the found applicationContexts to be started
 * @param parentInstanceIds   the instance-ids of the parent instance
 */
private boolean startDependency(List<ApplicationChildContext> applicationContexts,List<String> parentInstanceIds){
  if (applicationContexts == null || applicationContexts.isEmpty()) {
    log.info("String_Node_Str" + getMonitorType().toString().toLowerCase() + "String_Node_Str"+ this.id);
    return false;
  }
 else {
    for (    ApplicationChildContext context : applicationContexts) {
      if (!this.aliasToActiveChildMonitorsMap.containsKey(context.getId())) {
        log.info(String.format("String_Node_Str",getAppId(),context.getId()));
        startMonitor(this,context,parentInstanceIds);
      }
 else {
        log.info(String.format("String_Node_Str" + "String_Node_Str",getAppId(),context.getId()));
        Monitor monitor=aliasToActiveChildMonitorsMap.get(context.getId());
        for (        String instanceId : parentInstanceIds) {
          monitor.createInstanceOnDemand(instanceId);
        }
      }
    }
    return true;
  }
}

Fixed version (ground truth):
/** 
 * To start the dependency of the given application contexts
 * @param applicationContexts the found applicationContexts to be started
 * @param parentInstanceIds   the instance-ids of the parent instance
 */
private boolean startDependency(List<ApplicationChildContext> applicationContexts,List<String> parentInstanceIds){
  if (applicationContexts == null || applicationContexts.isEmpty()) {
    log.info("String_Node_Str" + getMonitorType().toString().toLowerCase() + "String_Node_Str"+ this.id);
    return false;
  }
 else {
    for (    ApplicationChildContext context : applicationContexts) {
      if (!this.aliasToActiveChildMonitorsMap.containsKey(context.getId())) {
        log.info(String.format("String_Node_Str",getAppId(),context.getId()));
        startMonitor(this,context,parentInstanceIds);
      }
 else {
        log.info(String.format("String_Node_Str" + "String_Node_Str",getAppId(),context.getId()));
        Monitor monitor=aliasToActiveChildMonitorsMap.get(context.getId());
        for (        String instanceId : parentInstanceIds) {
          if (monitor.getInstancesByParentInstanceId(instanceId) == null) {
            monitor.createInstanceOnDemand(instanceId);
          }
 else {
            log.info(String.format("String_Node_Str" + "String_Node_Str",getAppId(),context.getId()));
          }
        }
      }
    }
    return true;
  }
}