nus-yam/ex-repair huggingface dataset:
Program: 116474
Project: 116474
Buggy source:
private void updateChild(final String idOfChild,final ParentComponent component,final String appId){
  Runnable group=new Runnable(){
    public void run(){
      try {
        TopologyManager.acquireReadLockForApplication(appId);
        Map<String,ClusterDataHolder> clusterIds=component.getClusterDataMap();
        Map<String,Group> groups=component.getAliasToGroupMap();
        updateChildStatus(appId,idOfChild,groups,clusterIds,component);
      }
  finally {
        TopologyManager.releaseReadLockForApplication(appId);
      }
    }
  }
;
  Thread groupThread=new Thread(group);
  groupThread.start();
}

Fixed version (ground truth):
private void updateChild(final String idOfChild,final ParentComponent component,final String appId){
  Runnable group=new Runnable(){
    public void run(){
      try {
        TopologyManager.acquireReadLockForApplication(appId);
        ParentComponent component1=TopologyManager.getTopology().getApplication(appId).getGroupRecursively(component.getUniqueIdentifier());
        Map<String,ClusterDataHolder> clusterIds=component1.getClusterDataMap();
        Map<String,Group> groups=component1.getAliasToGroupMap();
        updateChildStatus(appId,idOfChild,groups,clusterIds,component1);
      }
  finally {
        TopologyManager.releaseReadLockForApplication(appId);
      }
    }
  }
;
  Thread groupThread=new Thread(group);
  groupThread.start();
}
Program: 116476
Project: 116476
Buggy source:
public static void plainTextWarn(final String elt){
  log.warn("String_Node_Str" + elt + "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
public static void plainTextWarn(final String elt){
  LOG.warn("String_Node_Str" + elt + "String_Node_Str"+ "String_Node_Str");
}
Program: 116477
Project: 116477
Buggy source:
/** 
 * @param xpath XPATH expression to be read.
 * @param elt OMElement to be used for the search.
 * @return List matching OMNode list
 */
@SuppressWarnings("String_Node_Str") public static OMNode getFirstMatchingNode(final String xpath,final OMElement elt) throws MalformedConfigurationFileException {
  AXIOMXPath axiomXpath;
  List<OMNode> nodeList=null;
  try {
    axiomXpath=new AXIOMXPath(xpath);
    nodeList=axiomXpath.selectNodes(elt);
    return nodeList.isEmpty() ? null : nodeList.get(0);
  }
 catch (  JaxenException e) {
    String msg="String_Node_Str" + xpath + "String_Node_Str";
    log.error(msg,e);
    throw new MalformedConfigurationFileException(msg,e);
  }
}

Fixed version (ground truth):
/** 
 * @param xpath XPATH expression to be read.
 * @param elt OMElement to be used for the search.
 * @return List matching OMNode list
 */
@SuppressWarnings("String_Node_Str") public static OMNode getFirstMatchingNode(final String xpath,final OMElement elt) throws MalformedConfigurationFileException {
  AXIOMXPath axiomXpath;
  List<OMNode> nodeList=null;
  try {
    axiomXpath=new AXIOMXPath(xpath);
    nodeList=axiomXpath.selectNodes(elt);
    return nodeList.isEmpty() ? null : nodeList.get(0);
  }
 catch (  JaxenException e) {
    String msg="String_Node_Str" + xpath + "String_Node_Str";
    LOG.error(msg,e);
    throw new MalformedConfigurationFileException(msg,e);
  }
}
Program: 116478
Project: 116478
Buggy source:
/** 
 * @param xpath XPATH expression to be read.
 * @param elt OMElement to be used for the search.
 * @return List matching OMNode list
 */
@SuppressWarnings("String_Node_Str") public static List<OMNode> getMatchingNodes(final String xpath,final OMElement elt) throws MalformedConfigurationFileException {
  AXIOMXPath axiomXpath;
  List<OMNode> nodeList=null;
  try {
    axiomXpath=new AXIOMXPath(xpath);
    nodeList=axiomXpath.selectNodes(elt);
    return nodeList;
  }
 catch (  JaxenException e) {
    String msg="String_Node_Str" + xpath + "String_Node_Str";
    log.error(msg,e);
    throw new MalformedConfigurationFileException(msg,e);
  }
}

Fixed version (ground truth):
/** 
 * @param xpath XPATH expression to be read.
 * @param elt OMElement to be used for the search.
 * @return List matching OMNode list
 */
@SuppressWarnings("String_Node_Str") public static List<OMNode> getMatchingNodes(final String xpath,final OMElement elt) throws MalformedConfigurationFileException {
  AXIOMXPath axiomXpath;
  List<OMNode> nodeList=null;
  try {
    axiomXpath=new AXIOMXPath(xpath);
    nodeList=axiomXpath.selectNodes(elt);
    return nodeList;
  }
 catch (  JaxenException e) {
    String msg="String_Node_Str" + xpath + "String_Node_Str";
    LOG.error(msg,e);
    throw new MalformedConfigurationFileException(msg,e);
  }
}
Program: 116479
Project: 116479
Buggy source:
public static OMElement parse(File xmlSource) throws MalformedConfigurationFileException, IllegalArgumentException {
  OMElement documentElement;
  if (xmlSource == null) {
    String msg="String_Node_Str";
    log.error(msg);
    throw new IllegalArgumentException(msg);
  }
  try {
    documentElement=new StAXOMBuilder(xmlSource.getPath()).getDocumentElement();
    return documentElement;
  }
 catch (  XMLStreamException e) {
    String msg="String_Node_Str" + xmlSource.getPath();
    log.error(msg,e);
    throw new MalformedConfigurationFileException(msg,e);
  }
catch (  FileNotFoundException e) {
    String msg="String_Node_Str" + xmlSource.getPath();
    log.error(msg);
    throw new MalformedConfigurationFileException(msg);
  }
}

Fixed version (ground truth):
public static OMElement parse(File xmlSource) throws MalformedConfigurationFileException, IllegalArgumentException {
  OMElement documentElement;
  if (xmlSource == null) {
    String msg="String_Node_Str";
    LOG.error(msg);
    throw new IllegalArgumentException(msg);
  }
  try {
    documentElement=new StAXOMBuilder(xmlSource.getPath()).getDocumentElement();
    return documentElement;
  }
 catch (  XMLStreamException e) {
    String msg="String_Node_Str" + xmlSource.getPath();
    LOG.error(msg,e);
    throw new MalformedConfigurationFileException(msg,e);
  }
catch (  FileNotFoundException e) {
    String msg="String_Node_Str" + xmlSource.getPath();
    LOG.error(msg);
    throw new MalformedConfigurationFileException(msg);
  }
}
Program: 116480
Project: 116480
Buggy source:
private static void neglectingWarn(final String fileName,final String elt,final int size){
  if (size > 1) {
    log.warn(fileName + "String_Node_Str" + elt+ "String_Node_Str"+ "String_Node_Str");
  }
}

Fixed version (ground truth):
private static void neglectingWarn(final String fileName,final String elt,final int size){
  if (size > 1) {
    LOG.warn(fileName + "String_Node_Str" + elt+ "String_Node_Str"+ "String_Node_Str");
  }
}
Program: 116482
Project: 116482
Buggy source:
/** 
 * Undeploys a Cartridge configuration which is already deployed.
 * @param cartridgeType type of the cartridge to be undeployed.
 * @throws InvalidCartridgeTypeException if the cartridge type specified is not a deployed cartridge.
 */
public void undeployCartridgeDefinition(String cartridgeType) throws InvalidCartridgeTypeException ;

Fixed version (ground truth):
/** 
 * Undeploys a Cartridge configuration which is already deployed.
 * @param cartridgeType type of the cartridge to be undeployed.
 * @throws InvalidCartridgeTypeException if the cartridge type specified is not a deployed cartridge.
 */
void undeployCartridgeDefinition(String cartridgeType) throws InvalidCartridgeTypeException ;
Program: 116483
Project: 116483
Buggy source:
/** 
 * <p> Registers the details of a newly created service cluster. This will override an already present service cluster, if there is any. A service cluster is uniquely identified by its domain and sub domain combination. </p>
 * @param clusterContext information about the new subscription.
 * @return whether the registration is successful or not.
 * @throws UnregisteredCartridgeException when the cartridge type requested by this service is not a registered one.
 */
public boolean registerService(Registrant registrant) throws UnregisteredCartridgeException ;

Fixed version (ground truth):
/** 
 * <p> Registers the details of a newly created service cluster. This will override an already present service cluster, if there is any. A service cluster is uniquely identified by its domain and sub domain combination. </p>
 * @param clusterContext information about the new subscription.
 * @return whether the registration is successful or not.
 * @throws UnregisteredCartridgeException when the cartridge type requested by this service is not a registered one.
 */
boolean registerService(Registrant registrant) throws UnregisteredCartridgeException ;
Program: 116484
Project: 116484
Buggy source:
/** 
 * Unregister the service cluster identified by the given cluster id.
 * @param clusterId service cluster id.
 * @throws UnregisteredClusterException if the service cluster requested is not a registered one.
 */
public void unregisterService(String clusterId) throws UnregisteredClusterException ;

Fixed version (ground truth):
/** 
 * Unregister the service cluster identified by the given cluster id.
 * @param clusterId service cluster id.
 * @throws UnregisteredClusterException if the service cluster requested is not a registered one.
 */
void unregisterService(String clusterId) throws UnregisteredClusterException ;
Program: 116485
Project: 116485
Buggy source:
/** 
 * Returns the   {@link org.apache.stratos.cloud.controller.pojo.ClusterContext} object associated with the given cluster id, or null if not found
 * @param clusterId cluster id
 * @return {@link org.apache.stratos.cloud.controller.pojo.ClusterContext} object  associated with the given cluster id, or null
 */
public ClusterContext getClusterContext(String clusterId);

Fixed version (ground truth):
/** 
 * Returns the   {@link org.apache.stratos.cloud.controller.pojo.ClusterContext} object associated with the given cluster id, or null if not found
 * @param clusterId cluster id
 * @return {@link org.apache.stratos.cloud.controller.pojo.ClusterContext} object  associated with the given cluster id, or null
 */
ClusterContext getClusterContext(String clusterId);
Program: 116486
Project: 116486
Buggy source:
/** 
 * Deploys a Cartridge configuration 
 * @param cartridgeConfig cartridge configuration to be deployed
 * @throws InvalidCartridgeDefinitionException if the cartridge configuration is not valid.
 * @throws InvalidIaasProviderException if the iaas providers configured are not valid.
 * @throws IllegalArgumentException  if the provided argument is not valid.
 */
public void deployCartridgeDefinition(CartridgeConfig cartridgeConfig) throws InvalidCartridgeDefinitionException, InvalidIaasProviderException ;

Fixed version (ground truth):
/** 
 * Deploys a Cartridge configuration 
 * @param cartridgeConfig cartridge configuration to be deployed
 * @throws InvalidCartridgeDefinitionException if the cartridge configuration is not valid.
 * @throws InvalidIaasProviderException if the iaas providers configured are not valid.
 * @throws IllegalArgumentException  if the provided argument is not valid.
 */
void deployCartridgeDefinition(CartridgeConfig cartridgeConfig) throws InvalidCartridgeDefinitionException, InvalidIaasProviderException ;
Program: 116487
Project: 116487
Buggy source:
/** 
 * Unregister a docker service identified by the given cluster id.
 * @param clusterId service cluster id.
 * @throws UnregisteredClusterException if the service cluster requested is not a registered one.
 */
public void unregisterDockerService(String clusterId) throws UnregisteredClusterException ;

Fixed version (ground truth):
/** 
 * Unregister a docker service identified by the given cluster id.
 * @param clusterId service cluster id.
 * @throws UnregisteredClusterException if the service cluster requested is not a registered one.
 */
void unregisterDockerService(String clusterId) throws UnregisteredClusterException ;
Program: 116488
Project: 116488
Buggy source:
/** 
 * Validate a given   {@link Partition} for basic property existence.
 * @param partition partition to be validated.
 * @return whether the partition is a valid one.
 * @throws InvalidPartitionException if the partition is invalid.
 */
public boolean validatePartition(Partition partition) throws InvalidPartitionException ;

Fixed version (ground truth):
/** 
 * Validate a given   {@link Partition} for basic property existence.
 * @param partition partition to be validated.
 * @return whether the partition is a valid one.
 * @throws InvalidPartitionException if the partition is invalid.
 */
boolean validatePartition(Partition partition) throws InvalidPartitionException ;
Program: 116489
Project: 116489
Buggy source:
/** 
 * Calling this method will result in returning the types of   {@link org.apache.stratos.cloud.controller.pojo.Cartridge}s registered in Cloud Controller.
 * @return String array containing types of registered {@link org.apache.stratos.cloud.controller.pojo.Cartridge}s.
 */
public String[] getRegisteredCartridges();

Fixed version (ground truth):
/** 
 * Calling this method will result in returning the types of   {@link org.apache.stratos.cloud.controller.pojo.Cartridge}s registered in Cloud Controller.
 * @return String array containing types of registered {@link org.apache.stratos.cloud.controller.pojo.Cartridge}s.
 */
String[] getRegisteredCartridges();
Program: 116490
Project: 116490
Buggy source:
/** 
 * Calling this method will result in termination of the instance with given member id in the given Partition.
 * @param memberId member ID of the instance to be terminated.
 * @param partition It contains the region, zone, network and host of a IaaS where an instance need to be terminated..
 * @return whether an instance terminated successfully or not.
 */
public void terminateInstance(String memberId) throws InvalidMemberException, InvalidCartridgeTypeException ;

Fixed version (ground truth):
/** 
 * Calling this method will result in termination of the instance with given member id in the given Partition.
 * @param memberId member ID of the instance to be terminated.
 * @param partition It contains the region, zone, network and host of a IaaS where an instance need to be terminated..
 * @return whether an instance terminated successfully or not.
 */
void terminateInstance(String memberId) throws InvalidMemberException, InvalidCartridgeTypeException ;
Program: 116491
Project: 116491
Buggy source:
/** 
 * Calling this method will result in termination of all instances belong to the provided cluster ID.
 * @param clusterId cluster ID of the instance to be terminated.
 * @return whether an instance terminated successfully or not.
 */
public void terminateAllInstances(String clusterId) throws InvalidClusterException ;

Fixed version (ground truth):
/** 
 * Calling this method will result in termination of all instances belong to the provided cluster ID.
 * @param clusterId cluster ID of the instance to be terminated.
 * @return whether an instance terminated successfully or not.
 */
void terminateAllInstances(String clusterId) throws InvalidClusterException ;
Program: 116492
Project: 116492
Buggy source:
/** 
 * Terminate all containers of the given cluster.
 * @param clusterId id of the subjected cluster.
 * @throws InvalidClusterException
 */
public void terminateAllContainers(String clusterId) throws InvalidClusterException ;

Fixed version (ground truth):
/** 
 * Terminate all containers of the given cluster.
 * @param clusterId id of the subjected cluster.
 * @throws InvalidClusterException
 */
void terminateAllContainers(String clusterId) throws InvalidClusterException ;
Program: 116493
Project: 116493
Buggy source:
/** 
 * This method will return the information regarding the given cartridge, if present. Else this will return <code>null</code>.
 * @param cartridgeType type of the cartridge.
 * @return {@link org.apache.stratos.cloud.controller.pojo.CartridgeInfo} of the given cartridge type or <code>null</code>.
 * @throws UnregisteredCartridgeException if there is no registered cartridge with this type.
 */
public CartridgeInfo getCartridgeInfo(String cartridgeType) throws UnregisteredCartridgeException ;

Fixed version (ground truth):
/** 
 * This method will return the information regarding the given cartridge, if present. Else this will return <code>null</code>.
 * @param cartridgeType type of the cartridge.
 * @return {@link org.apache.stratos.cloud.controller.pojo.CartridgeInfo} of the given cartridge type or <code>null</code>.
 * @throws UnregisteredCartridgeException if there is no registered cartridge with this type.
 */
CartridgeInfo getCartridgeInfo(String cartridgeType) throws UnregisteredCartridgeException ;
Program: 116494
Project: 116494
Buggy source:
/** 
 * Validate a given   {@link DeploymentPolicy} against a Cartridge.
 * @param cartridgeType type of the cartridge that this policy is going to be attached to.
 * @param deploymentPolicy policy to be validated.
 * @return whether the policy is a valid one against the given Cartridge.
 * @throws InvalidPartitionException if the policy contains at least one invalid partition.
 * @throws InvalidCartridgeTypeException if the given Cartridge type is not a valid one.
 */
public boolean validateDeploymentPolicy(String cartridgeType,Partition[] partitions) throws InvalidPartitionException, InvalidCartridgeTypeException ;

Fixed version (ground truth):
/** 
 * Validate a given   {@link DeploymentPolicy} against a Cartridge.
 * @param cartridgeType type of the cartridge that this policy is going to be attached to.
 * @param deploymentPolicy policy to be validated.
 * @return whether the policy is a valid one against the given Cartridge.
 * @throws InvalidPartitionException if the policy contains at least one invalid partition.
 * @throws InvalidCartridgeTypeException if the given Cartridge type is not a valid one.
 */
boolean validateDeploymentPolicy(String cartridgeType,Partition[] partitions) throws InvalidPartitionException, InvalidCartridgeTypeException ;
Program: 116495
Project: 116495
Buggy source:
/** 
 * Create a container cluster.
 * @param {@link ContainerClusterContext} Context with cluster id, and host cluster details. 
 * @return a list of {@link MemberContext}s correspond to each Pod created.
 * @throws UnregisteredCartridgeException if the requested Cartridge type is not a registered one.
 */
public MemberContext[] startContainers(ContainerClusterContext clusterContext) throws UnregisteredCartridgeException ;

Fixed version (ground truth):
/** 
 * Create a container cluster.
 * @param {@link ContainerClusterContext} Context with cluster id, and host cluster details. 
 * @return a list of {@link MemberContext}s correspond to each Pod created.
 * @throws UnregisteredCartridgeException if the requested Cartridge type is not a registered one.
 */
MemberContext[] startContainers(ContainerClusterContext clusterContext) throws UnregisteredCartridgeException ;
Program: 116496
Project: 116496
Buggy source:
/** 
 * Calling this method will result in an instance startup, which is belong to the provided Cluster ID. Also note that the instance that is starting up belongs to the group whose name is derived from its Cluster ID, replacing <i>.</i> by a hyphen (<i>-</i>).
 * @param Member Context with cluster id, partition etc.
 * @return updated {@link MemberContext}
 * @throws UnregisteredCartridgeException if the requested Cartridge type is not a registered one.
 * @throws InvalidIaasProviderException if the iaas requested is not valid.
 */
public MemberContext startInstance(MemberContext member) throws UnregisteredCartridgeException, InvalidIaasProviderException ;

Fixed version (ground truth):
/** 
 * Calling this method will result in an instance startup, which is belong to the provided Cluster ID. Also note that the instance that is starting up belongs to the group whose name is derived from its Cluster ID, replacing <i>.</i> by a hyphen (<i>-</i>).
 * @param Member Context with cluster id, partition etc.
 * @return updated {@link MemberContext}
 * @throws UnregisteredCartridgeException if the requested Cartridge type is not a registered one.
 * @throws InvalidIaasProviderException if the iaas requested is not valid.
 */
MemberContext startInstance(MemberContext member) throws UnregisteredCartridgeException, InvalidIaasProviderException ;
Program: 116497
Project: 116497
Buggy source:
protected void setTaskService(TaskService taskService){
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str");
  }
  ServiceReferenceHolder.getInstance().setTaskService(taskService);
}

Fixed version (ground truth):
protected void setTaskService(TaskService taskService){
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str");
  }
  ServiceReferenceHolder.getInstance().setTaskService(taskService);
}
Program: 116498
Project: 116498
Buggy source:
protected void activate(ComponentContext context){
  try {
    TopicSubscriber subscriber=new TopicSubscriber(CloudControllerConstants.INSTANCE_TOPIC);
    subscriber.setMessageListener(new InstanceStatusEventMessageListener());
    Thread tsubscriber=new Thread(subscriber);
    tsubscriber.start();
    InstanceStatusEventMessageDelegator delegator=new InstanceStatusEventMessageDelegator();
    Thread tdelegator=new Thread(delegator);
    tdelegator.start();
    BundleContext bundleContext=context.getBundleContext();
    bundleContext.registerService(CloudControllerService.class.getName(),new CloudControllerServiceImpl(),null);
    if (log.isInfoEnabled()) {
      log.info("String_Node_Str");
    }
    TopologySynchronizerTaskScheduler.schedule(ServiceReferenceHolder.getInstance().getTaskService());
  }
 catch (  Throwable e) {
    log.error("String_Node_Str",e);
  }
}

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

Fixed version (ground truth):
protected void unsetRegistryService(RegistryService registryService){
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str");
  }
  ServiceReferenceHolder.getInstance().setRegistry(null);
}
Program: 116500
Project: 116500
Buggy source:
protected void setRegistryService(RegistryService registryService){
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str");
  }
  try {
    UserRegistry registry=registryService.getGovernanceSystemRegistry();
    ServiceReferenceHolder.getInstance().setRegistry(registry);
  }
 catch (  RegistryException e) {
    String msg="String_Node_Str";
    log.error(msg,e);
    throw new CloudControllerException(msg,e);
  }
}

Fixed version (ground truth):
protected void setRegistryService(RegistryService registryService){
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str");
  }
  try {
    UserRegistry registry=registryService.getGovernanceSystemRegistry();
    ServiceReferenceHolder.getInstance().setRegistry(registry);
  }
 catch (  RegistryException e) {
    String msg="String_Node_Str";
    LOG.error(msg,e);
    throw new CloudControllerException(msg,e);
  }
}
Program: 116501
Project: 116501
Buggy source:
protected void unsetTaskService(TaskService taskService){
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str");
  }
  ServiceReferenceHolder.getInstance().setTaskService(null);
}

Fixed version (ground truth):
protected void unsetTaskService(TaskService taskService){
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str");
  }
  ServiceReferenceHolder.getInstance().setTaskService(null);
}
Program: 116502
Project: 116502
Buggy source:
public Object executeList(String serviceEndpoint,Class _class,String entityName) throws CommandException {
  DefaultHttpClient httpClient=new DefaultHttpClient();
  HttpResponse response=null;
  try {
    response=restClient.doGet(httpClient,restClient.getBaseURL() + serviceEndpoint);
    int responseCode=response.getStatusLine().getStatusCode();
    if (responseCode != 200) {
      String resultString=getHttpResponseString(response);
      if (StringUtils.isBlank(resultString)) {
        return null;
      }
 else {
        GsonBuilder gsonBuilder=new GsonBuilder();
        Gson gson=gsonBuilder.create();
        ExceptionMapper exception=gson.fromJson(resultString,ExceptionMapper.class);
        if (exception != null) {
          System.out.println(exception);
        }
        return gson.fromJson(resultString,_class);
      }
    }
    return null;
  }
 catch (  Exception e) {
    handleException(String.format("String_Node_Str",entityName),e);
    return null;
  }
 finally {
    httpClient.getConnectionManager().shutdown();
  }
}

Fixed version (ground truth):
public Object executeList(String serviceEndpoint,Class _class,String entityName) throws CommandException {
  DefaultHttpClient httpClient=new DefaultHttpClient();
  HttpResponse response=null;
  try {
    response=restClient.doGet(httpClient,restClient.getBaseURL() + serviceEndpoint);
    int responseCode=response.getStatusLine().getStatusCode();
    String resultString=getHttpResponseString(response);
    GsonBuilder gsonBuilder=new GsonBuilder();
    Gson gson=gsonBuilder.create();
    if (responseCode == 200) {
      return gson.fromJson(resultString,_class);
    }
 else {
      if (StringUtils.isBlank(resultString)) {
        return null;
      }
 else {
        ExceptionMapper exception=gson.fromJson(resultString,ExceptionMapper.class);
        if (exception != null) {
          System.out.println(exception);
        }
        return gson.fromJson(resultString,_class);
      }
    }
  }
 catch (  Exception e) {
    handleException(String.format("String_Node_Str",entityName),e);
    return null;
  }
 finally {
    httpClient.getConnectionManager().shutdown();
  }
}
Program: 116503
Project: 116503
Buggy source:
private boolean getGroupStatus(Map<String,Group> groups){
  boolean groupActiveStatus=false;
  for (  Group group : groups.values()) {
    if (group.getStatus().equals(GroupStatus.Active)) {
      groupActiveStatus=true;
    }
 else {
      groupActiveStatus=false;
    }
  }
  return groupActiveStatus;
}

Fixed version (ground truth):
private boolean getGroupStatus(Map<String,Group> groups){
  boolean groupActiveStatus=false;
  for (  Group group : groups.values()) {
    if (group.getStatus() == Status.Activated) {
      groupActiveStatus=true;
    }
 else {
      groupActiveStatus=false;
    }
  }
  return groupActiveStatus;
}
Program: 116504
Project: 116504
Buggy source:
/** 
 * Utility method to find the group monitor recursively within app monitor
 * @param id       the unique alias of the Group
 * @param monitors the group monitors found in the app monitor
 * @return the found GroupMonitor
 */
private GroupMonitor findGroupMonitor(String id,Collection<GroupMonitor> monitors){
  for (  GroupMonitor monitor : monitors) {
    if (monitor.equals(id)) {
      return monitor;
    }
 else {
      if (monitor.getAliasToGroupMonitorsMap() != null) {
        return findGroupMonitor(id,monitor.getAliasToGroupMonitorsMap().values());
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Utility method to find the group monitor recursively within app monitor
 * @param id       the unique alias of the Group
 * @param monitors the group monitors found in the app monitor
 * @return the found GroupMonitor
 */
private GroupMonitor findGroupMonitor(String id,Collection<GroupMonitor> monitors){
  for (  GroupMonitor monitor : monitors) {
    if (monitor.getId().equals(id)) {
      return monitor;
    }
 else {
      if (monitor.getAliasToGroupMonitorsMap() != null) {
        return findGroupMonitor(id,monitor.getAliasToGroupMonitorsMap().values());
      }
    }
  }
  return null;
}
Program: 116505
Project: 116505
Buggy source:
public static void handleGroupActivatedEvent(GroupActivatedEvent groupActivatedEvent){
  Topology topology=TopologyManager.getTopology();
  Application application=topology.getApplication(groupActivatedEvent.getAppId());
  if (application == null) {
    log.warn(String.format("String_Node_Str",groupActivatedEvent.getAppId()));
    return;
  }
  Group group=application.getGroup(groupActivatedEvent.getGroupId());
  if (group == null) {
    log.warn(String.format("String_Node_Str",groupActivatedEvent.getGroupId()));
    return;
  }
  org.apache.stratos.messaging.event.topology.GroupActivatedEvent groupActivatedEvent1=new org.apache.stratos.messaging.event.topology.GroupActivatedEvent(groupActivatedEvent.getAppId(),groupActivatedEvent.getGroupId());
  try {
    TopologyManager.acquireWriteLock();
    group.setStatus(Status.Activated);
    log.info("String_Node_Str");
    TopologyManager.updateTopology(topology);
  }
  finally {
    TopologyManager.releaseWriteLock();
  }
  TopologyEventPublisher.sendGroupActivatedEvent(groupActivatedEvent1);
}

Fixed version (ground truth):
public static void handleGroupActivatedEvent(GroupActivatedEvent groupActivatedEvent){
  Topology topology=TopologyManager.getTopology();
  Application application=topology.getApplication(groupActivatedEvent.getAppId());
  if (application == null) {
    log.warn(String.format("String_Node_Str",groupActivatedEvent.getAppId()));
    return;
  }
  Group group=application.getGroupRecursively(groupActivatedEvent.getGroupId());
  if (group == null) {
    log.warn(String.format("String_Node_Str",groupActivatedEvent.getGroupId()));
    return;
  }
  org.apache.stratos.messaging.event.topology.GroupActivatedEvent groupActivatedEvent1=new org.apache.stratos.messaging.event.topology.GroupActivatedEvent(groupActivatedEvent.getAppId(),groupActivatedEvent.getGroupId());
  try {
    TopologyManager.acquireWriteLock();
    group.setStatus(Status.Activated);
    log.info("String_Node_Str");
    TopologyManager.updateTopology(topology);
  }
  finally {
    TopologyManager.releaseWriteLock();
  }
  TopologyEventPublisher.sendGroupActivatedEvent(groupActivatedEvent1);
}
Program: 116506
Project: 116506
Buggy source:
private Group travereAndCheckRecursively(Map<String,Group> aliasToGroupMap,String groupAlias){
  if (aliasToGroupMap.containsKey(groupAlias)) {
synchronized (aliasToGroupMap) {
      if (aliasToGroupMap.containsKey(groupAlias)) {
        return aliasToGroupMap.get(groupAlias);
      }
    }
  }
 else {
    for (    Group group : aliasToGroupMap.values()) {
      travereAndCheckRecursively(group.getAliasToGroupMap(),groupAlias);
    }
  }
  return null;
}

Fixed version (ground truth):
private Group travereAndCheckRecursively(Map<String,Group> aliasToGroupMap,String groupAlias){
  if (aliasToGroupMap.containsKey(groupAlias)) {
synchronized (aliasToGroupMap) {
      if (aliasToGroupMap.containsKey(groupAlias)) {
        return aliasToGroupMap.get(groupAlias);
      }
    }
  }
 else {
    for (    Group group : aliasToGroupMap.values()) {
      return travereAndCheckRecursively(group.getAliasToGroupMap(),groupAlias);
    }
  }
  return null;
}
Program: 116507
Project: 116507
Buggy source:
private boolean doProcess(GroupActivatedEvent event,Topology topology){
  Application application=topology.getApplication(event.getAppId());
  if (application == null) {
    if (log.isWarnEnabled()) {
      log.warn(String.format("String_Node_Str",event.getAppId()));
    }
    return false;
  }
  Group group=application.getGroup(event.getGroupId());
  if (group == null) {
    if (log.isWarnEnabled()) {
      log.warn(String.format("String_Node_Str",event.getAppId(),event.getGroupId()));
    }
  }
 else {
    group.setStatus(Status.Activated);
    if (log.isInfoEnabled()) {
      log.info(String.format("String_Node_Str",group.toString()));
    }
  }
  notifyEventListeners(event);
  return true;
}

Fixed version (ground truth):
private boolean doProcess(GroupActivatedEvent event,Topology topology){
  Application application=topology.getApplication(event.getAppId());
  if (application == null) {
    if (log.isWarnEnabled()) {
      log.warn(String.format("String_Node_Str",event.getAppId()));
    }
    return false;
  }
  Group group=application.getGroupRecursively(event.getGroupId());
  if (group == null) {
    if (log.isWarnEnabled()) {
      log.warn(String.format("String_Node_Str",event.getAppId(),event.getGroupId()));
    }
  }
 else {
    group.setStatus(Status.Activated);
    if (log.isInfoEnabled()) {
      log.info(String.format("String_Node_Str",group.toString()));
    }
  }
  notifyEventListeners(event);
  return true;
}
Program: 116510
Project: 116510
Buggy source:
/** 
 * Will return the GroupContext/ClusterContext based on the type in start order
 * @param startOrder reference of group/cluster in the start order
 * @param component The component which used to build the dependency
 * @param isKillDependent kill dependent behaviour of this component
 * @return Context
 */
public static ApplicationContext getApplicationContext(String startOrder,ParentComponent component,boolean isKillDependent){
  String id;
  ApplicationContext applicationContext=null;
  if (startOrder.contains(Constants.GROUP)) {
    id=getGroupFromStartupOrder(startOrder);
    applicationContext=new GroupContext(id,isKillDependent);
  }
 else   if (startOrder.contains(Constants.CARTRIDGE)) {
    id=getClusterFromStartupOrder(startOrder);
    ClusterDataHolder clusterDataHolder=component.getClusterDataMap().get(id);
    applicationContext=new ClusterContext(clusterDataHolder.getClusterId(),isKillDependent);
  }
 else {
    log.warn("String_Node_Str" + startOrder + "String_Node_Str");
  }
  return applicationContext;
}

Fixed version (ground truth):
/** 
 * Will return the GroupContext/ClusterContext based on the type in start order
 * @param startOrder reference of group/cluster in the start order
 * @param component The component which used to build the dependency
 * @param isKillDependent kill dependent behaviour of this component
 * @return Context
 */
public static ApplicationContext getApplicationContext(String startOrder,ParentComponent component,boolean isKillDependent){
  String id;
  ApplicationContext applicationContext=null;
  if (startOrder.startsWith(Constants.GROUP + "String_Node_Str")) {
    id=getGroupFromStartupOrder(startOrder);
    applicationContext=new GroupContext(id,isKillDependent);
  }
 else   if (startOrder.startsWith(Constants.CARTRIDGE + "String_Node_Str")) {
    id=getClusterFromStartupOrder(startOrder);
    ClusterDataHolder clusterDataHolder=component.getClusterDataMap().get(id);
    applicationContext=new ClusterContext(clusterDataHolder.getClusterId(),isKillDependent);
  }
 else {
    log.warn("String_Node_Str" + startOrder + "String_Node_Str");
  }
  return applicationContext;
}
Program: 116512
Project: 116512
Buggy source:
public String getUniqueIdentifier(){
  return name;
}

Fixed version (ground truth):
public String getUniqueIdentifier(){
  return alias;
}
Program: 116514
Project: 116514
Buggy source:
@Override public boolean process(String type,String message,Object object){
  Topology topology=(Topology)object;
  if (CompleteTopologyEvent.class.getName().equals(type)) {
    CompleteTopologyEvent event=(CompleteTopologyEvent)Util.jsonToObject(message,CompleteTopologyEvent.class);
    if (!topology.isInitialized()) {
      TopologyUpdater.acquireWriteLock();
      try {
        if (!topology.isInitialized()) {
          doProcess(event,topology);
        }
      }
  finally {
        TopologyUpdater.releaseWriteLock();
      }
    }
    notifyEventListeners(event);
    return true;
  }
 else {
    if (nextProcessor != null) {
      return nextProcessor.process(type,message,topology);
    }
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean process(String type,String message,Object object){
  Topology topology=(Topology)object;
  if (CompleteTopologyEvent.class.getName().equals(type)) {
    CompleteTopologyEvent event=(CompleteTopologyEvent)Util.jsonToObject(message,CompleteTopologyEvent.class);
    if (!topology.isInitialized()) {
      TopologyUpdater.acquireWriteLock();
      try {
        doProcess(event,topology);
      }
  finally {
        TopologyUpdater.releaseWriteLock();
      }
    }
    notifyEventListeners(event);
    return true;
  }
 else {
    if (nextProcessor != null) {
      return nextProcessor.process(type,message,topology);
    }
    return false;
  }
}
Program: 116517
Project: 116517
Buggy source:
@Override protected void monitor(MonitorStatusEvent statusEvent){
  String id=statusEvent.getId();
  ApplicationContext context=this.dependencyTree.findApplicationContextWithId(id);
  if (context.getStatusLifeCycle().isEmpty()) {
    try {
      boolean startDep=startDependency(statusEvent.getId());
      context.setStatus(status);
      context.addStatusToLIfeCycle(statusEvent.getStatus());
      if (!startDep) {
        StatusChecker.getInstance().onChildStatusChange(id,this.component,this.appId);
      }
    }
 catch (    TopologyInConsistentException e) {
      log.error(e);
    }
  }
 else {
  }
}

Fixed version (ground truth):
@Override protected void monitor(MonitorStatusEvent statusEvent){
  String id=statusEvent.getId();
  ApplicationContext context=this.dependencyTree.findApplicationContextWithId(id);
  if (context.getStatusLifeCycle().isEmpty()) {
    try {
      boolean startDep=startDependency(statusEvent.getId());
      context.setStatus(statusEvent.getStatus());
      context.addStatusToLIfeCycle(statusEvent.getStatus());
      if (!startDep) {
        StatusChecker.getInstance().onChildStatusChange(id,this.component,this.appId);
      }
    }
 catch (    TopologyInConsistentException e) {
      log.error(e);
    }
  }
 else {
  }
}
Program: 116518
Project: 116518
Buggy source:
@Override public boolean process(String type,String message,Object object){
  if (ClusterActivatedEvent.class.getName().equals(type)) {
    GroupActivatedEvent event=(GroupActivatedEvent)Util.jsonToObject(message,GroupActivatedEvent.class);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + event.toString());
    }
    notifyEventListeners(event);
    return true;
  }
 else {
    if (nextProcessor != null) {
      return nextProcessor.process(type,message,object);
    }
 else {
      throw new RuntimeException(String.format("String_Node_Str" + "String_Node_Str",type,message));
    }
  }
}

Fixed version (ground truth):
@Override public boolean process(String type,String message,Object object){
  if (GroupActivatedEvent.class.getName().equals(type)) {
    GroupActivatedEvent event=(GroupActivatedEvent)Util.jsonToObject(message,GroupActivatedEvent.class);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + event.toString());
    }
    notifyEventListeners(event);
    return true;
  }
 else {
    if (nextProcessor != null) {
      return nextProcessor.process(type,message,object);
    }
 else {
      throw new RuntimeException(String.format("String_Node_Str" + "String_Node_Str",type,message));
    }
  }
}
Program: 116519
Project: 116519
Buggy source:
@Override public boolean process(String type,String message,Object object){
  Topology topology=(Topology)object;
  if (CompleteTopologyEvent.class.getName().equals(type)) {
    CompleteTopologyEvent event=(CompleteTopologyEvent)Util.jsonToObject(message,CompleteTopologyEvent.class);
    if (!topology.isInitialized()) {
      TopologyUpdater.acquireWriteLock();
      try {
        return topology.isInitialized() || doProcess(event,topology);
      }
  finally {
        TopologyUpdater.releaseWriteLock();
      }
    }
 else {
      return true;
    }
  }
 else {
    if (nextProcessor != null) {
      return nextProcessor.process(type,message,topology);
    }
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean process(String type,String message,Object object){
  Topology topology=(Topology)object;
  if (CompleteTopologyEvent.class.getName().equals(type)) {
    CompleteTopologyEvent event=(CompleteTopologyEvent)Util.jsonToObject(message,CompleteTopologyEvent.class);
    if (!topology.isInitialized()) {
      TopologyUpdater.acquireWriteLock();
      try {
        if (!topology.isInitialized()) {
          doProcess(event,topology);
        }
      }
  finally {
        TopologyUpdater.releaseWriteLock();
      }
    }
    notifyEventListeners(event);
    return true;
  }
 else {
    if (nextProcessor != null) {
      return nextProcessor.process(type,message,topology);
    }
    return false;
  }
}
Program: 116521
Project: 116521
Buggy source:
public ClusterMonitor(String clusterId,String serviceId,DeploymentPolicy deploymentPolicy,AutoscalePolicy autoscalePolicy){
  this.clusterId=clusterId;
  this.serviceId=serviceId;
  this.autoscalerRuleEvaluator=new AutoscalerRuleEvaluator();
  this.scaleCheckKnowledgeSession=autoscalerRuleEvaluator.getScaleCheckStatefulSession();
  this.minCheckKnowledgeSession=autoscalerRuleEvaluator.getMinCheckStatefulSession();
  this.terminateDependencyKnowledgeSession=autoscalerRuleEvaluator.getTerminateDependencyStatefulSession();
  this.deploymentPolicy=deploymentPolicy;
  this.autoscalePolicy=autoscalePolicy;
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + autoscalePolicy);
  }
  networkPartitionCtxts=new ConcurrentHashMap<String,NetworkPartitionContext>();
}

Fixed version (ground truth):
public ClusterMonitor(String clusterId,String serviceId,DeploymentPolicy deploymentPolicy,AutoscalePolicy autoscalePolicy){
  this.clusterId=clusterId;
  this.serviceId=serviceId;
  this.autoscalerRuleEvaluator=new AutoscalerRuleEvaluator();
  this.scaleCheckKnowledgeSession=autoscalerRuleEvaluator.getScaleCheckStatefulSession();
  this.minCheckKnowledgeSession=autoscalerRuleEvaluator.getMinCheckStatefulSession();
  this.terminateDependencyKnowledgeSession=autoscalerRuleEvaluator.getTerminateDependencyStatefulSession();
  this.deploymentPolicy=deploymentPolicy;
  this.autoscalePolicy=autoscalePolicy;
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + autoscalePolicy);
  }
  networkPartitionCtxts=new ConcurrentHashMap<String,NetworkPartitionContext>();
  status=Status.Created;
}
Program: 116524
Project: 116524
Buggy source:
public void run(){
  ApplicationMonitor applicationMonitor=null;
  int retries=5;
  boolean success=false;
  do {
    try {
      Thread.sleep(5000);
    }
 catch (    InterruptedException e1) {
    }
    try {
      long start=System.currentTimeMillis();
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + application.getId());
      }
      applicationMonitor=AutoscalerUtil.getApplicationMonitor(application);
      long end=System.currentTimeMillis();
      log.info("String_Node_Str" + (end - start) / 1000);
      success=true;
    }
 catch (    Exception e) {
      String msg="String_Node_Str";
      log.warn(msg,e);
      retries--;
    }
  }
 while (!success && retries != 0);
  if (applicationMonitor == null) {
    String msg="String_Node_Str" + "String_Node_Str" + application.getId();
    log.error(msg);
    throw new RuntimeException(msg);
  }
  AutoscalerContext.getInstance().addAppMonitor(applicationMonitor);
  if (log.isInfoEnabled()) {
    log.info(String.format("String_Node_Str" + "String_Node_Str",applicationMonitor.getId()));
  }
}

Fixed version (ground truth):
public void run(){
  ApplicationMonitor applicationMonitor=null;
  int retries=5;
  boolean success=false;
  do {
    try {
      Thread.sleep(5000);
    }
 catch (    InterruptedException e1) {
    }
    try {
      long start=System.currentTimeMillis();
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + application.getId());
      }
      applicationMonitor=AutoscalerUtil.getApplicationMonitor(application);
      long end=System.currentTimeMillis();
      log.info("String_Node_Str" + (end - start) / 1000);
      success=true;
    }
 catch (    DependencyBuilderException e) {
      String msg="String_Node_Str";
      log.warn(msg,e);
      retries--;
    }
catch (    TopologyInConsistentException e) {
      String msg="String_Node_Str";
      log.warn(msg,e);
      retries--;
    }
  }
 while (!success && retries != 0);
  if (applicationMonitor == null) {
    String msg="String_Node_Str" + "String_Node_Str" + application.getId();
    log.error(msg);
    throw new RuntimeException(msg);
  }
  AutoscalerContext.getInstance().addAppMonitor(applicationMonitor);
  if (log.isInfoEnabled()) {
    log.info(String.format("String_Node_Str" + "String_Node_Str",applicationMonitor.getId()));
  }
}
Program: 116526
Project: 116526
Buggy source:
public static ApplicationContext getApplicationContext(String startOrder,ParentBehavior component,DependencyTree dependencyTree){
  String id;
  ApplicationContext applicationContext=null;
  if (startOrder.contains("String_Node_Str")) {
    id=getGroupFromStartupOrder(startOrder);
    applicationContext=new GroupContext(component.getGroup(id).getAlias(),dependencyTree.isKillDependent());
  }
 else   if (startOrder.contains("String_Node_Str")) {
    id=getClusterFromStartupOrder(startOrder);
    applicationContext=new ClusterContext(component.getClusterData(id).getClusterId(),dependencyTree.isKillDependent());
  }
 else {
  }
  return applicationContext;
}

Fixed version (ground truth):
public static ApplicationContext getApplicationContext(String startOrder,ParentComponent component,DependencyTree dependencyTree){
  String id;
  ApplicationContext applicationContext=null;
  if (startOrder.contains("String_Node_Str")) {
    id=getGroupFromStartupOrder(startOrder);
    applicationContext=new GroupContext(component.getGroup(id).getAlias(),dependencyTree.isKillDependent());
  }
 else   if (startOrder.contains("String_Node_Str")) {
    id=getClusterFromStartupOrder(startOrder);
    applicationContext=new ClusterContext(component.getClusterData(id).getClusterId(),dependencyTree.isKillDependent());
  }
 else {
  }
  return applicationContext;
}