nus-yam/ex-repair huggingface dataset:
Program: 115795
Project: 115795
Buggy source:
public KubernetesCluster getKubernetesClusterContainingHost(String hostId) throws NonExistingKubernetesClusterException {
  if (StringUtils.isEmpty(hostId)) {
    return null;
  }
  for (  KubernetesCluster kubernetesCluster : kubernetesClustersMap.values()) {
    if (hostId.equals(kubernetesCluster.getKubernetesMaster().getHostId())) {
      return kubernetesCluster;
    }
    if (kubernetesCluster.getKubernetesHosts() != null) {
      for (      KubernetesHost kubernetesHost : kubernetesCluster.getKubernetesHosts()) {
        if (kubernetesHost.getHostId().equals(hostId)) {
          return kubernetesCluster;
        }
      }
    }
  }
  throw new NonExistingKubernetesClusterException("String_Node_Str" + hostId);
}

Fixed version (ground truth):
public KubernetesCluster getKubernetesClusterContainingHost(String hostId) throws NonExistingKubernetesClusterException {
  if (StringUtils.isEmpty(hostId)) {
    return null;
  }
  for (  KubernetesCluster kubernetesCluster : kubernetesClustersMap.values()) {
    if (hostId.equals(kubernetesCluster.getKubernetesMaster().getHostId())) {
      return kubernetesCluster;
    }
    if (kubernetesCluster.getKubernetesHosts() != null) {
      for (      KubernetesHost kubernetesHost : kubernetesCluster.getKubernetesHosts()) {
        if (kubernetesHost.getHostId().equals(hostId)) {
          return kubernetesCluster;
        }
      }
    }
  }
  throw new NonExistingKubernetesClusterException("String_Node_Str" + "String_Node_Str" + hostId);
}
Program: 115796
Project: 115796
Buggy source:
public KubernetesCluster getKubernetesCluster(String kubernetesClusterId) throws NonExistingKubernetesClusterException {
  if (StringUtils.isEmpty(kubernetesClusterId)) {
    throw new NonExistingKubernetesClusterException("String_Node_Str");
  }
  KubernetesCluster kubernetesCluster=kubernetesClustersMap.get(kubernetesClusterId);
  if (kubernetesCluster != null) {
    return kubernetesCluster;
  }
  throw new NonExistingKubernetesClusterException("String_Node_Str" + kubernetesClusterId);
}

Fixed version (ground truth):
public KubernetesCluster getKubernetesCluster(String kubernetesClusterId) throws NonExistingKubernetesClusterException {
  if (StringUtils.isEmpty(kubernetesClusterId)) {
    throw new NonExistingKubernetesClusterException("String_Node_Str");
  }
  KubernetesCluster kubernetesCluster=kubernetesClustersMap.get(kubernetesClusterId);
  if (kubernetesCluster != null) {
    return kubernetesCluster;
  }
  throw new NonExistingKubernetesClusterException("String_Node_Str" + "String_Node_Str" + kubernetesClusterId);
}
Program: 115797
Project: 115797
Buggy source:
protected void getClusterData(Set<ClusterDataHolder> clusterData,Collection<Group> groups){
  for (  Group group : groups) {
    if (group.getClusterDataMap() != null && !group.getClusterDataMap().isEmpty()) {
      clusterData.addAll(group.getClusterDataMap().values());
      if (group.getGroups() != null) {
        getClusterData(clusterData,group.getGroups());
      }
    }
  }
}

Fixed version (ground truth):
protected void getClusterData(Set<ClusterDataHolder> clusterData,Collection<Group> groups){
  for (  Group group : groups) {
    if (group.getClusterDataMap() != null && !group.getClusterDataMap().isEmpty()) {
      clusterData.addAll(group.getClusterDataMap().values());
    }
    if (group.getGroups() != null && !group.getGroups().isEmpty()) {
      getClusterData(clusterData,group.getGroups());
    }
  }
}
Program: 115798
Project: 115798
Buggy source:
@Override public void disconnect(){
  if (topicConnection != null) {
    try {
      topicConnection.stop();
    }
 catch (    JMSException ignore) {
      log.warn("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
@Override public void disconnect(){
  if (topicConnection != null) {
    try {
      topicConnection.stop();
      topicConnection.close();
    }
 catch (    JMSException ignore) {
      log.warn("String_Node_Str");
    }
  }
}
Program: 115799
Project: 115799
Buggy source:
/** 
 * Publish message to message broker.
 * @param message Message to be published
 * @param retry   Retry if message broker is not available
 */
@Override public void publish(String message,boolean retry){
  boolean published=false;
  while (!published) {
    try {
      while (connectionStatus == ConnectionStatus.ReConnecting) {
        try {
          Thread.sleep(1000);
        }
 catch (        InterruptedException ignore) {
        }
      }
      if (connectionStatus == ConnectionStatus.ReConnected) {
        Thread.sleep(2000);
        connectionStatus=ConnectionStatus.Connected;
      }
      TopicSession topicSession=newSession();
      Topic topic=lookupTopic(topicName);
      if (topic == null) {
        topic=topicSession.createTopic(topicName);
      }
      javax.jms.TopicPublisher topicPublisher=topicSession.createPublisher(topic);
      TextMessage textMessage=topicSession.createTextMessage(message);
      topicPublisher.publish(textMessage);
      published=true;
    }
 catch (    Exception e) {
      String errorMessage="String_Node_Str";
      log.error(errorMessage,e);
      if (!retry) {
        throw new MessagingException(errorMessage,e);
      }
      reconnect();
    }
  }
}

Fixed version (ground truth):
/** 
 * Publish message to message broker.
 * @param message Message to be published
 * @param retry   Retry if message broker is not available
 */
@Override public void publish(String message,boolean retry){
  boolean published=false;
  while (!published) {
    TopicSession topicSession=null;
    javax.jms.TopicPublisher topicPublisher=null;
    try {
      while (connectionStatus == ConnectionStatus.ReConnecting) {
        try {
          Thread.sleep(1000);
        }
 catch (        InterruptedException ignore) {
        }
      }
      if (connectionStatus == ConnectionStatus.ReConnected) {
        Thread.sleep(2000);
        connectionStatus=ConnectionStatus.Connected;
      }
      topicSession=newSession();
      Topic topic=lookupTopic(topicName);
      if (topic == null) {
        topic=topicSession.createTopic(topicName);
      }
      topicPublisher=topicSession.createPublisher(topic);
      TextMessage textMessage=topicSession.createTextMessage(message);
      topicPublisher.publish(textMessage);
      published=true;
    }
 catch (    Exception e) {
      String errorMessage="String_Node_Str";
      log.error(errorMessage,e);
      if (!retry) {
        throw new MessagingException(errorMessage,e);
      }
      reconnect();
    }
 finally {
      try {
        if (topicSession != null) {
          topicSession.close();
        }
        if (topicPublisher != null) {
          topicPublisher.close();
        }
      }
 catch (      JMSException e) {
        message="String_Node_Str";
        log.error(message,e);
        throw new MessagingException(message,e);
      }
    }
  }
}
Program: 115800
Project: 115800
Buggy source:
/** 
 * Convert the object to its JSON representation and publish to the given topic.
 */
public void publish(Object messageObj,boolean retry){
synchronized (EventPublisher.class) {
    Gson gson=new Gson();
    String message=gson.toJson(messageObj);
    topicPublisher.connect();
    topicPublisher.publish(message,retry);
  }
}

Fixed version (ground truth):
/** 
 * Convert the object to its JSON representation and publish to the given topic.
 */
public void publish(Object messageObj,boolean retry){
synchronized (EventPublisher.class) {
    Gson gson=new Gson();
    String message=gson.toJson(messageObj);
    topicPublisher.connect();
    topicPublisher.publish(message,retry);
    topicPublisher.disconnect();
  }
}
Program: 115801
Project: 115801
Buggy source:
public void setLastname(String lastname){
  this.lastname=lastname;
}

Fixed version (ground truth):
public void setLastname(String lastName){
  this.lastName=lastName;
}
Program: 115802
Project: 115802
Buggy source:
public String getFirstname(){
  return firstname;
}

Fixed version (ground truth):
public String getFirstname(){
  return firstName;
}
Program: 115803
Project: 115803
Buggy source:
public void setFirstname(String firstname){
  this.firstname=firstname;
}

Fixed version (ground truth):
public void setFirstname(String firstName){
  this.firstName=firstName;
}
Program: 115804
Project: 115804
Buggy source:
public String getLastname(){
  return lastname;
}

Fixed version (ground truth):
public String getLastname(){
  return lastName;
}
Program: 115805
Project: 115805
Buggy source:
public void setLastname(String lastname){
  this.lastname=lastname;
}

Fixed version (ground truth):
public void setLastname(String lastName){
  this.lastName=lastName;
}
Program: 115806
Project: 115806
Buggy source:
public void setFirstname(String firstname){
  this.firstname=firstname;
}

Fixed version (ground truth):
public void setFirstname(String firstName){
  this.firstName=firstName;
}
Program: 115807
Project: 115807
Buggy source:
public TenantInfoBean(TenantInfoBean tenantInfoBean){
  this.admin=tenantInfoBean.admin;
  this.firstname=tenantInfoBean.firstname;
  this.lastname=tenantInfoBean.lastname;
  this.adminPassword=tenantInfoBean.adminPassword;
  this.tenantDomain=tenantInfoBean.tenantDomain;
  this.tenantId=tenantInfoBean.tenantId;
  this.email=tenantInfoBean.email;
  this.active=tenantInfoBean.active;
  this.successKey=tenantInfoBean.successKey;
  this.createdDate=tenantInfoBean.createdDate;
  this.originatedService=tenantInfoBean.originatedService;
  this.usagePlan=tenantInfoBean.usagePlan;
}

Fixed version (ground truth):
public TenantInfoBean(TenantInfoBean tenantInfoBean){
  this.admin=tenantInfoBean.admin;
  this.firstName=tenantInfoBean.firstName;
  this.lastName=tenantInfoBean.lastName;
  this.adminPassword=tenantInfoBean.adminPassword;
  this.tenantDomain=tenantInfoBean.tenantDomain;
  this.tenantId=tenantInfoBean.tenantId;
  this.email=tenantInfoBean.email;
  this.active=tenantInfoBean.active;
  this.successKey=tenantInfoBean.successKey;
  this.createdDate=tenantInfoBean.createdDate;
  this.originatedService=tenantInfoBean.originatedService;
  this.usagePlan=tenantInfoBean.usagePlan;
}
Program: 115808
Project: 115808
Buggy source:
public String getFirstname(){
  return firstname;
}

Fixed version (ground truth):
public String getFirstname(){
  return firstName;
}
Program: 115809
Project: 115809
Buggy source:
public String getLastname(){
  return lastname;
}

Fixed version (ground truth):
public String getLastname(){
  return lastName;
}
Program: 115810
Project: 115810
Buggy source:
public static void sendClusterTerminatedEvent(String appId,String serviceName,String clusterId,String instanceId){
  try {
    TopologyManager.acquireReadLockForCluster(serviceName,clusterId);
    Service service=TopologyManager.getTopology().getService(serviceName);
    if (service != null) {
      Cluster cluster=service.getCluster(clusterId);
      ClusterInstance clusterInstance=cluster.getInstanceContexts(instanceId);
      if (clusterInstance == null) {
        log.warn(String.format("String_Node_Str",instanceId));
        return;
      }
      if (clusterInstance.isStateTransitionValid(ClusterStatus.Terminated)) {
        if (clusterInstance.getStatus() != ClusterStatus.Terminated) {
          ClusterStatusClusterTerminatedEvent appStatusClusterTerminatedEvent=new ClusterStatusClusterTerminatedEvent(appId,serviceName,clusterId,instanceId);
          publishEvent(appStatusClusterTerminatedEvent);
        }
 else {
          if (log.isDebugEnabled()) {
            log.warn("String_Node_Str" + clusterId);
          }
        }
      }
 else {
        log.warn("String_Node_Str" + clusterInstance.getInstanceId() + "String_Node_Str"+ clusterId+ "String_Node_Str"+ clusterInstance.getStatus());
      }
    }
  }
  finally {
    TopologyManager.releaseReadLockForCluster(serviceName,clusterId);
  }
}

Fixed version (ground truth):
public static void sendClusterTerminatedEvent(String appId,String serviceName,String clusterId,String instanceId){
  try {
    Service service=TopologyManager.getTopology().getService(serviceName);
    if (service != null) {
      Cluster cluster=service.getCluster(clusterId);
      ClusterInstance clusterInstance=cluster.getInstanceContexts(instanceId);
      if (clusterInstance == null) {
        log.warn(String.format("String_Node_Str",instanceId));
        return;
      }
      if (clusterInstance.isStateTransitionValid(ClusterStatus.Terminated)) {
        if (clusterInstance.getStatus() != ClusterStatus.Terminated) {
          ClusterStatusClusterTerminatedEvent appStatusClusterTerminatedEvent=new ClusterStatusClusterTerminatedEvent(appId,serviceName,clusterId,instanceId);
          publishEvent(appStatusClusterTerminatedEvent);
        }
 else {
          if (log.isDebugEnabled()) {
            log.warn("String_Node_Str" + clusterId);
          }
        }
      }
 else {
        log.warn("String_Node_Str" + clusterInstance.getInstanceId() + "String_Node_Str"+ clusterId+ "String_Node_Str"+ clusterInstance.getStatus());
      }
    }
  }
  finally {
  }
}
Program: 115811
Project: 115811
Buggy source:
private void detachVolume(MemberContext ctxt){
  String clusterId=ctxt.getClusterId();
  ClusterContext clusterContext=CloudControllerContext.getInstance().getClusterContext(clusterId);
  if (clusterContext.getVolumes() != null) {
    for (    Volume volume : clusterContext.getVolumes()) {
      try {
        String volumeId=volume.getId();
        if (volumeId == null) {
          return;
        }
        detachVolume(ctxt.getInstanceId(),volumeId);
        if (volume.isRemoveOntermination()) {
          deleteVolume(volumeId);
        }
      }
 catch (      ResourceNotFoundException ignore) {
        if (log.isDebugEnabled()) {
          log.debug(ignore);
        }
      }
    }
  }
}

Fixed version (ground truth):
private void detachVolume(MemberContext ctxt){
  String clusterId=ctxt.getClusterId();
  ClusterContext clusterContext=CloudControllerContext.getInstance().getClusterContext(clusterId);
  if (clusterContext == null) {
    log.error(String.format("String_Node_Str",ctxt.getMemberId(),clusterId));
    return;
  }
  if (clusterContext.getVolumes() != null) {
    for (    Volume volume : clusterContext.getVolumes()) {
      try {
        String volumeId=volume.getId();
        if (volumeId == null) {
          return;
        }
        detachVolume(ctxt.getInstanceId(),volumeId);
        if (volume.isRemoveOntermination()) {
          deleteVolume(volumeId);
        }
      }
 catch (      ResourceNotFoundException ignore) {
        if (log.isDebugEnabled()) {
          log.debug(ignore);
        }
      }
    }
  }
}
Program: 115812
Project: 115812
Buggy source:
private boolean doProcess(ApplicationClustersRemovedEvent event,Topology topology){
  Set<ClusterDataHolder> clusterData=event.getClusterData();
  if (clusterData != null) {
    for (    ClusterDataHolder aClusterData : clusterData) {
      TopologyUpdater.acquireWriteLockForService(aClusterData.getServiceType());
      try {
        Service aService=topology.getService(aClusterData.getServiceType());
        if (aService != null) {
          if (aService.clusterExists(aClusterData.getClusterId())) {
            aService.removeCluster(aClusterData.getClusterId());
            log.info("String_Node_Str" + aClusterData.getClusterId() + "String_Node_Str"+ event.getAppId());
          }
 else {
            if (log.isDebugEnabled()) {
              log.debug("String_Node_Str" + aClusterData.getClusterId() + "String_Node_Str"+ event.getAppId()+ "String_Node_Str");
            }
          }
        }
 else {
          log.warn("String_Node_Str" + aClusterData.getServiceType() + "String_Node_Str"+ aClusterData.getClusterId());
        }
      }
  finally {
        TopologyUpdater.releaseWriteLockForService(aClusterData.getServiceType());
      }
    }
  }
 else {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + event.getAppId() + "String_Node_Str");
    }
  }
  notifyEventListeners(event);
  return true;
}

Fixed version (ground truth):
private boolean doProcess(ApplicationClustersRemovedEvent event,Topology topology){
  Set<ClusterDataHolder> clusterData=event.getClusterData();
  if (clusterData != null) {
    for (    ClusterDataHolder aClusterData : clusterData) {
      String serviceType=aClusterData.getServiceType();
      TopologyUpdater.acquireWriteLockForService(serviceType);
      try {
        Service aService=topology.getService(serviceType);
        if (aService != null) {
          if (aService.clusterExists(aClusterData.getClusterId())) {
            aService.removeCluster(aClusterData.getClusterId());
            log.info("String_Node_Str" + aClusterData.getClusterId() + "String_Node_Str"+ event.getAppId());
          }
 else {
            if (log.isDebugEnabled()) {
              log.debug("String_Node_Str" + aClusterData.getClusterId() + "String_Node_Str"+ event.getAppId()+ "String_Node_Str");
            }
          }
        }
 else {
          log.warn("String_Node_Str" + serviceType + "String_Node_Str"+ aClusterData.getClusterId());
        }
      }
  finally {
        TopologyUpdater.releaseWriteLockForService(serviceType);
      }
    }
  }
 else {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + event.getAppId() + "String_Node_Str");
    }
  }
  notifyEventListeners(event);
  return true;
}
Program: 115813
Project: 115813
Buggy source:
public void updateDeploymentPolicyInInformationModel(DeploymentPolicy deploymentPolicy) throws InvalidPolicyException {
  if (autoscalePolicyListMap.containsKey(deploymentPolicy.getDeploymentPolicyID())) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + deploymentPolicy.getDeploymentPolicyID());
    }
    deploymentPolicyListMap.put(deploymentPolicy.getDeploymentPolicyID(),deploymentPolicy);
  }
}

Fixed version (ground truth):
public void updateDeploymentPolicyInInformationModel(DeploymentPolicy deploymentPolicy) throws InvalidPolicyException {
  if (deploymentPolicyListMap.containsKey(deploymentPolicy.getDeploymentPolicyID())) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + deploymentPolicy.getDeploymentPolicyID());
    }
    deploymentPolicyListMap.put(deploymentPolicy.getDeploymentPolicyID(),deploymentPolicy);
  }
}
Program: 115814
Project: 115814
Buggy source:
/** 
 * Create vm/container instance.
 * @param memberContext
 * @return updated memberContext
 */
public abstract MemberContext startInstance(MemberContext memberContext) throws CartridgeNotFoundException ;

Fixed version (ground truth):
/** 
 * Create vm/container instance.
 * @param memberContext
 * @param payload
 * @return updated memberContext
 */
public abstract MemberContext startInstance(MemberContext memberContext,byte[] payload) throws CartridgeNotFoundException ;
Program: 115815
Project: 115815
Buggy source:
@Override public MemberContext startInstance(MemberContext memberContext){
  String clusterId=memberContext.getClusterId();
  String str=clusterId.length() > 10 ? clusterId.substring(0,10) : clusterId.substring(0,clusterId.length());
  String group=str.replaceAll("String_Node_Str","String_Node_Str");
  try {
    ComputeService computeService=getIaasProvider().getComputeService();
    Template template=getIaasProvider().getTemplate();
    if (template == null) {
      String msg="String_Node_Str" + getIaasProvider().getType();
      log.error(msg);
      throw new InvalidIaasProviderException(msg);
    }
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + memberContext + "String_Node_Str");
    }
    Set<? extends NodeMetadata> nodeMetadataSet=computeService.createNodesInGroup(group,1,template);
    NodeMetadata nodeMetadata=nodeMetadataSet.iterator().next();
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + memberContext + "String_Node_Str");
    }
    if (nodeMetadata == null) {
      String msg="String_Node_Str" + memberContext.toString();
      log.error(msg);
      throw new IllegalStateException(msg);
    }
    memberContext.setInstanceId(nodeMetadata.getId());
    memberContext.setInstanceMetadata(createInstanceMetadata(nodeMetadata));
  }
 catch (  Exception e) {
    String msg="String_Node_Str" + memberContext.toString() + "String_Node_Str"+ e.getMessage();
    log.error(msg,e);
    throw new IllegalStateException(msg,e);
  }
  return memberContext;
}

Fixed version (ground truth):
@Override public MemberContext startInstance(MemberContext memberContext,byte[] payload){
  this.setDynamicPayload(payload);
  String clusterId=memberContext.getClusterId();
  String str=clusterId.length() > 10 ? clusterId.substring(0,10) : clusterId.substring(0,clusterId.length());
  String group=str.replaceAll("String_Node_Str","String_Node_Str");
  try {
    ComputeService computeService=getIaasProvider().getComputeService();
    Template template=getIaasProvider().getTemplate();
    if (template == null) {
      String msg="String_Node_Str" + getIaasProvider().getType();
      log.error(msg);
      throw new InvalidIaasProviderException(msg);
    }
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + memberContext + "String_Node_Str");
    }
    Set<? extends NodeMetadata> nodeMetadataSet=computeService.createNodesInGroup(group,1,template);
    NodeMetadata nodeMetadata=nodeMetadataSet.iterator().next();
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + memberContext + "String_Node_Str");
    }
    if (nodeMetadata == null) {
      String msg="String_Node_Str" + memberContext.toString();
      log.error(msg);
      throw new IllegalStateException(msg);
    }
    memberContext.setInstanceId(nodeMetadata.getId());
    memberContext.setInstanceMetadata(createInstanceMetadata(nodeMetadata));
  }
 catch (  Exception e) {
    String msg="String_Node_Str" + memberContext.toString() + "String_Node_Str"+ e.getMessage();
    log.error(msg,e);
    throw new IllegalStateException(msg,e);
  }
  return memberContext;
}
Program: 115816
Project: 115816
Buggy source:
@Override public MemberContext startInstance(MemberContext memberContext) throws CartridgeNotFoundException {
  return startContainer(memberContext);
}

Fixed version (ground truth):
@Override public MemberContext startInstance(MemberContext memberContext,byte[] payload) throws CartridgeNotFoundException {
  setDynamicPayload(payload);
  return startContainer(memberContext);
}
Program: 115817
Project: 115817
Buggy source:
@Override public MemberContext startInstance(MemberContext memberContext){
  MockInstanceContext mockInstanceContext=new MockInstanceContext(memberContext.getApplicationId(),memberContext.getCartridgeType(),memberContext.getClusterId(),memberContext.getMemberId(),memberContext.getClusterInstanceId(),memberContext.getNetworkPartitionId(),memberContext.getPartition().getId());
  MockInstanceMetadata mockInstanceMetadata=apiClient.startInstance(mockInstanceContext);
  memberContext.setInstanceId(mockInstanceMetadata.getInstanceId());
  return memberContext;
}

Fixed version (ground truth):
@Override public MemberContext startInstance(MemberContext memberContext,byte[] payload){
  MockInstanceContext mockInstanceContext=new MockInstanceContext(memberContext.getApplicationId(),memberContext.getCartridgeType(),memberContext.getClusterId(),memberContext.getMemberId(),memberContext.getClusterInstanceId(),memberContext.getNetworkPartitionId(),memberContext.getPartition().getId());
  setDynamicPayload(payload);
  MockInstanceMetadata mockInstanceMetadata=apiClient.startInstance(mockInstanceContext);
  memberContext.setInstanceId(mockInstanceMetadata.getInstanceId());
  return memberContext;
}
Program: 115819
Project: 115819
Buggy source:
public InstanceCreator(MemberContext memberContext,IaasProvider iaasProvider){
  this.memberContext=memberContext;
  this.iaasProvider=iaasProvider;
}

Fixed version (ground truth):
public InstanceCreator(MemberContext memberContext,IaasProvider iaasProvider,byte[] payload){
  this.memberContext=memberContext;
  this.iaasProvider=iaasProvider;
  this.payload=payload;
}
Program: 115821
Project: 115821
Buggy source:
private MemberContext startInstance(Iaas iaas,MemberContext memberContext) throws CartridgeNotFoundException {
  memberContext=iaas.startInstance(memberContext);
  String instanceId=memberContext.getInstanceId();
  if (StringUtils.isBlank(instanceId)) {
    String msg=String.format("String_Node_Str",memberContext.getCartridgeType(),memberContext.getMemberId());
    log.error(msg);
    throw new IllegalStateException(msg);
  }
  CloudControllerContext.getInstance().updateMemberContext(memberContext);
  CloudControllerContext.getInstance().persist();
  if (log.isDebugEnabled()) {
    log.debug(String.format("String_Node_Str",memberContext.getApplicationId(),memberContext.getCartridgeType(),memberContext.getMemberId()));
  }
  return memberContext;
}

Fixed version (ground truth):
private MemberContext startInstance(Iaas iaas,MemberContext memberContext,byte[] payload) throws CartridgeNotFoundException {
  memberContext=iaas.startInstance(memberContext,payload);
  String instanceId=memberContext.getInstanceId();
  if (StringUtils.isBlank(instanceId)) {
    String msg=String.format("String_Node_Str",memberContext.getCartridgeType(),memberContext.getMemberId());
    log.error(msg);
    throw new IllegalStateException(msg);
  }
  CloudControllerContext.getInstance().updateMemberContext(memberContext);
  CloudControllerContext.getInstance().persist();
  if (log.isDebugEnabled()) {
    log.debug(String.format("String_Node_Str",memberContext.getApplicationId(),memberContext.getCartridgeType(),memberContext.getMemberId()));
  }
  return memberContext;
}
Program: 115822
Project: 115822
Buggy source:
private boolean doProcess(String clusterId,String instanceId){
  ClusterMonitor monitor=(ClusterMonitor)AutoscalerContext.getInstance().getClusterMonitor(clusterId);
  boolean clusterMonitorHasMembers=clusterInstanceHasMembers(monitor,instanceId);
  boolean clusterTerminated=false;
  String serviceId=monitor.getServiceId();
  try {
    TopologyManager.acquireReadLockForCluster(serviceId,clusterId);
    Service service=TopologyManager.getTopology().getService(serviceId);
    Cluster cluster;
    String appId=monitor.getAppId();
    if (service != null) {
      cluster=service.getCluster(clusterId);
      if (cluster != null) {
        try {
          ApplicationHolder.acquireReadLock();
          if (!clusterMonitorHasMembers) {
            if (log.isInfoEnabled()) {
              log.info("String_Node_Str" + appId + "String_Node_Str"+ clusterId);
            }
            ClusterStatusEventPublisher.sendClusterStatusTerminatedEvent(appId,serviceId,clusterId,instanceId);
            clusterTerminated=true;
          }
 else {
            log.info("String_Node_Str" + cluster.getInstanceContexts(instanceId).getStatus().toString());
          }
        }
  finally {
          ApplicationHolder.releaseReadLock();
        }
      }
    }
  }
  finally {
    TopologyManager.releaseReadLockForCluster(serviceId,clusterId);
  }
  return clusterTerminated;
}

Fixed version (ground truth):
private boolean doProcess(String clusterId,String instanceId){
  ClusterMonitor monitor=(ClusterMonitor)AutoscalerContext.getInstance().getClusterMonitor(clusterId);
  boolean clusterMonitorHasMembers=clusterInstanceHasMembers(monitor,instanceId);
  boolean clusterTerminated=false;
  String serviceId=monitor.getServiceId();
  try {
    TopologyManager.acquireReadLockForCluster(serviceId,clusterId);
    Service service=TopologyManager.getTopology().getService(serviceId);
    Cluster cluster;
    String appId=monitor.getAppId();
    if (service != null) {
      cluster=service.getCluster(clusterId);
      if (cluster != null) {
        try {
          ApplicationHolder.acquireReadLock();
          if (!clusterMonitorHasMembers) {
            if (log.isInfoEnabled()) {
              log.info("String_Node_Str" + appId + "String_Node_Str"+ clusterId);
            }
            ClusterStatusEventPublisher.sendClusterTerminatedEvent(appId,serviceId,clusterId,instanceId);
            clusterTerminated=true;
          }
 else {
            log.info("String_Node_Str" + cluster.getInstanceContexts(instanceId).getStatus().toString());
          }
        }
  finally {
          ApplicationHolder.releaseReadLock();
        }
      }
    }
  }
  finally {
    TopologyManager.releaseReadLockForCluster(serviceId,clusterId);
  }
  return clusterTerminated;
}
Program: 115824
Project: 115824
Buggy source:
private boolean doProcess(String clusterId,String instanceId){
  ClusterMonitor monitor=(ClusterMonitor)AutoscalerContext.getInstance().getClusterMonitor(clusterId);
  boolean clusterMonitorHasMembers=clusterInstanceHasMembers(monitor,instanceId);
  boolean clusterTerminated=false;
  try {
    TopologyManager.acquireReadLockForCluster(monitor.getServiceId(),monitor.getClusterId());
    Service service=TopologyManager.getTopology().getService(monitor.getServiceId());
    Cluster cluster;
    String appId=monitor.getAppId();
    if (service != null) {
      cluster=service.getCluster(monitor.getClusterId());
      if (cluster != null) {
        try {
          ApplicationHolder.acquireReadLock();
          if (!clusterMonitorHasMembers) {
            if (log.isInfoEnabled()) {
              log.info("String_Node_Str" + appId + "String_Node_Str"+ clusterId);
            }
            ClusterStatusEventPublisher.sendClusterTerminatedEvent(appId,monitor.getServiceId(),monitor.getClusterId(),instanceId);
            clusterTerminated=true;
          }
 else {
            log.info("String_Node_Str" + cluster.getInstanceContexts(instanceId).getStatus().toString());
          }
        }
  finally {
          ApplicationHolder.releaseReadLock();
        }
      }
    }
  }
  finally {
    TopologyManager.releaseReadLockForCluster(monitor.getServiceId(),monitor.getClusterId());
  }
  return clusterTerminated;
}

Fixed version (ground truth):
private boolean doProcess(String clusterId,String instanceId){
  ClusterMonitor monitor=(ClusterMonitor)AutoscalerContext.getInstance().getClusterMonitor(clusterId);
  boolean clusterMonitorHasMembers=clusterInstanceHasMembers(monitor,instanceId);
  boolean clusterTerminated=false;
  String serviceId=monitor.getServiceId();
  try {
    TopologyManager.acquireReadLockForCluster(serviceId,clusterId);
    Service service=TopologyManager.getTopology().getService(serviceId);
    Cluster cluster;
    String appId=monitor.getAppId();
    if (service != null) {
      cluster=service.getCluster(clusterId);
      if (cluster != null) {
        try {
          ApplicationHolder.acquireReadLock();
          if (!clusterMonitorHasMembers) {
            if (log.isInfoEnabled()) {
              log.info("String_Node_Str" + appId + "String_Node_Str"+ clusterId);
            }
            ClusterStatusEventPublisher.sendClusterStatusTerminatedEvent(appId,serviceId,clusterId,instanceId);
            clusterTerminated=true;
          }
 else {
            log.info("String_Node_Str" + cluster.getInstanceContexts(instanceId).getStatus().toString());
          }
        }
  finally {
          ApplicationHolder.releaseReadLock();
        }
      }
    }
  }
  finally {
    TopologyManager.releaseReadLockForCluster(serviceId,clusterId);
  }
  return clusterTerminated;
}
Program: 115825
Project: 115825
Buggy source:
public TenantInfoBean[] retrievePartialSearchTenants(String searchDomain) throws RestAPIException {
  List<TenantInfoBean> searchResult=new LinkedList<TenantInfoBean>();
  for (  String tenantDomain : tenantMap.keySet()) {
    if (tenantDomain.contains(searchDomain)) {
      searchResult.add(new TenantInfoBean(tenantMap.get(tenantDomain)));
    }
  }
  return searchResult.toArray(new TenantInfoBean[0]);
}

Fixed version (ground truth):
public TenantInfoBean[] retrievePartialSearchTenants(String searchDomain) throws RestAPIException {
  List<TenantInfoBean> searchResult=new LinkedList<TenantInfoBean>();
  for (  String tenantDomain : tenantMap.keySet()) {
    if (tenantDomain.contains(searchDomain)) {
      searchResult.add(new TenantInfoBean(tenantMap.get(tenantDomain)));
    }
  }
  return searchResult.toArray(new TenantInfoBean[searchResult.size()]);
}
Program: 115826
Project: 115826
Buggy source:
public DeploymentPolicyBean[] getDeploymentPoliciesForCartridgeType(String cartridgeType) throws RestAPIException {
  int tenantId=getTenantId();
  if (!deploymentPolicyMap.containsKey(tenantId)) {
    if (!deploymentPolicyMap.containsKey(PUBLIC_DEFINITION)) {
      return new HashMap<String,DeploymentPolicyBean>().values().toArray(new DeploymentPolicyBean[0]);
    }
 else {
      return (deploymentPolicyMap.get(PUBLIC_DEFINITION)).values().toArray(new DeploymentPolicyBean[0]);
    }
  }
 else {
    return (deploymentPolicyMap.get(tenantId)).values().toArray(new DeploymentPolicyBean[0]);
  }
}

Fixed version (ground truth):
public DeploymentPolicyBean[] getDeploymentPoliciesForCartridgeType(String cartridgeType) throws RestAPIException {
  int tenantId=getTenantId();
  if (!deploymentPolicyMap.containsKey(tenantId)) {
    if (!deploymentPolicyMap.containsKey(PUBLIC_DEFINITION)) {
      Collection<DeploymentPolicyBean> depPolicies=new HashMap<String,DeploymentPolicyBean>().values();
      return depPolicies.toArray(new DeploymentPolicyBean[depPolicies.size()]);
    }
 else {
      Collection<DeploymentPolicyBean> depPolicies=(deploymentPolicyMap.get(PUBLIC_DEFINITION)).values();
      return depPolicies.toArray(new DeploymentPolicyBean[depPolicies.size()]);
    }
  }
 else {
    Collection<DeploymentPolicyBean> depPolicies=(deploymentPolicyMap.get(tenantId)).values();
    return depPolicies.toArray(new DeploymentPolicyBean[depPolicies.size()]);
  }
}
Program: 115827
Project: 115827
Buggy source:
public CartridgeBean[] getSubscribedCartridges() throws RestAPIException {
  int tenantId=getTenantId();
  if (!subscribedCartridges.containsKey(tenantId) && !subscribedCartridges.containsKey(PUBLIC_DEFINITION)) {
    return new HashMap<String,CartridgeBean>().values().toArray(new CartridgeBean[0]);
  }
  List<CartridgeBean> p=new ArrayList<CartridgeBean>();
  if (subscribedCartridges.get(tenantId) != null)   p.addAll(subscribedCartridges.get(tenantId).values());
  if (subscribedCartridges.get(PUBLIC_DEFINITION) != null)   p.addAll(subscribedCartridges.get(PUBLIC_DEFINITION).values());
  return p.toArray(new CartridgeBean[0]);
}

Fixed version (ground truth):
public CartridgeBean[] getSubscribedCartridges() throws RestAPIException {
  int tenantId=getTenantId();
  if (!subscribedCartridges.containsKey(tenantId) && !subscribedCartridges.containsKey(PUBLIC_DEFINITION)) {
    Collection<CartridgeBean> cartridges=new HashMap<String,CartridgeBean>().values();
    return cartridges.toArray(new CartridgeBean[cartridges.size()]);
  }
  List<CartridgeBean> cartridges=new ArrayList<CartridgeBean>();
  if (subscribedCartridges.get(tenantId) != null)   cartridges.addAll(subscribedCartridges.get(tenantId).values());
  if (subscribedCartridges.get(PUBLIC_DEFINITION) != null)   cartridges.addAll(subscribedCartridges.get(PUBLIC_DEFINITION).values());
  return cartridges.toArray(new CartridgeBean[cartridges.size()]);
}
Program: 115828
Project: 115828
Buggy source:
public PartitionBean[] getPartitions(String deploymentPolicyId,String partitionGroupId) throws RestAPIException {
  int tenantId=getTenantId();
  DeploymentPolicyBean deploymentPolicy;
  if (!deploymentPolicyMap.containsKey(tenantId)) {
    if (!deploymentPolicyMap.containsKey(PUBLIC_DEFINITION)) {
      throw new RestAPIException(Status.NO_CONTENT,"String_Node_Str");
    }
 else {
      if (!(deploymentPolicyMap.get(PUBLIC_DEFINITION)).containsKey(deploymentPolicyId)) {
        throw new RestAPIException(Status.NO_CONTENT,"String_Node_Str" + deploymentPolicyId);
      }
 else {
        deploymentPolicy=(deploymentPolicyMap.get(PUBLIC_DEFINITION)).get(deploymentPolicyId);
      }
    }
  }
 else {
    if (!(deploymentPolicyMap.get(tenantId)).containsKey(deploymentPolicyId)) {
      throw new RestAPIException(Status.NO_CONTENT,"String_Node_Str" + deploymentPolicyId);
    }
 else {
      deploymentPolicy=(deploymentPolicyMap.get(tenantId)).get(deploymentPolicyId);
    }
  }
  PartitionBean[] partitions=null;
  for (  NetworkPartitionRefBean networkPartition : deploymentPolicy.getNetworkPartitions()) {
    if (networkPartition.getId().equals(partitionGroupId)) {
      partitions=networkPartition.getPartitions().toArray(new PartitionBean[0]);
    }
  }
  if (partitions == null) {
    throw new RestAPIException(Status.NO_CONTENT,"String_Node_Str");
  }
  return partitions;
}

Fixed version (ground truth):
public PartitionBean[] getPartitions(String deploymentPolicyId,String partitionGroupId) throws RestAPIException {
  int tenantId=getTenantId();
  DeploymentPolicyBean deploymentPolicy;
  if (!deploymentPolicyMap.containsKey(tenantId)) {
    if (!deploymentPolicyMap.containsKey(PUBLIC_DEFINITION)) {
      throw new RestAPIException(Status.NO_CONTENT,"String_Node_Str");
    }
 else {
      if (!(deploymentPolicyMap.get(PUBLIC_DEFINITION)).containsKey(deploymentPolicyId)) {
        throw new RestAPIException(Status.NO_CONTENT,"String_Node_Str" + deploymentPolicyId);
      }
 else {
        deploymentPolicy=(deploymentPolicyMap.get(PUBLIC_DEFINITION)).get(deploymentPolicyId);
      }
    }
  }
 else {
    if (!(deploymentPolicyMap.get(tenantId)).containsKey(deploymentPolicyId)) {
      throw new RestAPIException(Status.NO_CONTENT,"String_Node_Str" + deploymentPolicyId);
    }
 else {
      deploymentPolicy=(deploymentPolicyMap.get(tenantId)).get(deploymentPolicyId);
    }
  }
  PartitionBean[] partitions=null;
  for (  NetworkPartitionRefBean networkPartition : deploymentPolicy.getNetworkPartitions()) {
    if (networkPartition.getId().equals(partitionGroupId)) {
      List<PartitionRefBean> partitionRefs=networkPartition.getPartitions();
      partitions=partitionRefs.toArray(new PartitionBean[partitionRefs.size()]);
    }
  }
  if (partitions == null) {
    throw new RestAPIException(Status.NO_CONTENT,"String_Node_Str");
  }
  return partitions;
}
Program: 115829
Project: 115829
Buggy source:
public CartridgeBean[] getAvailableSingleTenantCartridges() throws RestAPIException {
  int tenantId=getTenantId();
  if (!availableSingleTenantCartridges.containsKey(tenantId) && !availableSingleTenantCartridges.containsKey(PUBLIC_DEFINITION)) {
    return new HashMap<String,CartridgeBean>().values().toArray(new CartridgeBean[0]);
  }
  List<CartridgeBean> p=new ArrayList<CartridgeBean>();
  if (availableSingleTenantCartridges.get(tenantId) != null)   p.addAll(availableSingleTenantCartridges.get(tenantId).values());
  if (availableSingleTenantCartridges.get(PUBLIC_DEFINITION) != null)   p.addAll(availableSingleTenantCartridges.get(PUBLIC_DEFINITION).values());
  return p.toArray(new CartridgeBean[0]);
}

Fixed version (ground truth):
public CartridgeBean[] getAvailableSingleTenantCartridges() throws RestAPIException {
  int tenantId=getTenantId();
  if (!availableSingleTenantCartridges.containsKey(tenantId) && !availableSingleTenantCartridges.containsKey(PUBLIC_DEFINITION)) {
    Collection<CartridgeBean> cartridges=new HashMap<String,CartridgeBean>().values();
    return cartridges.toArray(new CartridgeBean[cartridges.size()]);
  }
  List<CartridgeBean> cartridges=new ArrayList<CartridgeBean>();
  if (availableSingleTenantCartridges.get(tenantId) != null)   cartridges.addAll(availableSingleTenantCartridges.get(tenantId).values());
  if (availableSingleTenantCartridges.get(PUBLIC_DEFINITION) != null)   cartridges.addAll(availableSingleTenantCartridges.get(PUBLIC_DEFINITION).values());
  return cartridges.toArray(new CartridgeBean[cartridges.size()]);
}
Program: 115830
Project: 115830
Buggy source:
public TenantInfoBean[] getTenants() throws RestAPIException {
  return tenantMap.values().toArray(new TenantInfoBean[0]);
}

Fixed version (ground truth):
public TenantInfoBean[] getTenants() throws RestAPIException {
  Collection<TenantInfoBean> tenants=tenantMap.values();
  return tenants.toArray(new TenantInfoBean[tenants.size()]);
}
Program: 115831
Project: 115831
Buggy source:
public PartitionBean[] getPartitionsOfPolicy(String deploymentPolicyId) throws RestAPIException {
  int tenantId=getTenantId();
  if (!deploymentPolicyMap.containsKey(tenantId)) {
    if (!deploymentPolicyMap.containsKey(PUBLIC_DEFINITION)) {
      throw new RestAPIException(Status.NO_CONTENT,"String_Node_Str");
    }
 else {
      if (!(deploymentPolicyMap.get(PUBLIC_DEFINITION)).containsKey(deploymentPolicyId)) {
        throw new RestAPIException(Status.NO_CONTENT,"String_Node_Str" + deploymentPolicyId);
      }
      return (deploymentPolicyMap.get(PUBLIC_DEFINITION)).get(deploymentPolicyId).getNetworkPartitions().get(0).getPartitions().toArray(new PartitionBean[0]);
    }
  }
  if (!(deploymentPolicyMap.get(tenantId)).containsKey(deploymentPolicyId)) {
    throw new RestAPIException(Status.NO_CONTENT,"String_Node_Str" + deploymentPolicyId);
  }
  return (deploymentPolicyMap.get(tenantId)).get(deploymentPolicyId).getNetworkPartitions().get(0).getPartitions().toArray(new PartitionBean[0]);
}

Fixed version (ground truth):
public PartitionBean[] getPartitionsOfPolicy(String deploymentPolicyId) throws RestAPIException {
  int tenantId=getTenantId();
  if (!deploymentPolicyMap.containsKey(tenantId)) {
    if (!deploymentPolicyMap.containsKey(PUBLIC_DEFINITION)) {
      throw new RestAPIException(Status.NO_CONTENT,"String_Node_Str");
    }
 else {
      if (!(deploymentPolicyMap.get(PUBLIC_DEFINITION)).containsKey(deploymentPolicyId)) {
        throw new RestAPIException(Status.NO_CONTENT,"String_Node_Str" + deploymentPolicyId);
      }
      List<PartitionRefBean> partitions=(deploymentPolicyMap.get(PUBLIC_DEFINITION)).get(deploymentPolicyId).getNetworkPartitions().get(0).getPartitions();
      return partitions.toArray(new PartitionBean[partitions.size()]);
    }
  }
  if (!(deploymentPolicyMap.get(tenantId)).containsKey(deploymentPolicyId)) {
    throw new RestAPIException(Status.NO_CONTENT,"String_Node_Str" + deploymentPolicyId);
  }
  List<PartitionRefBean> partitions=(deploymentPolicyMap.get(tenantId)).get(deploymentPolicyId).getNetworkPartitions().get(0).getPartitions();
  return partitions.toArray(new PartitionBean[partitions.size()]);
}
Program: 115832
Project: 115832
Buggy source:
public ClusterBean[] getClusters() throws RestAPIException {
  return clusterMap.values().toArray(new ClusterBean[0]);
}

Fixed version (ground truth):
public ClusterBean[] getClusters() throws RestAPIException {
  Collection<ClusterBean> clusters=clusterMap.values();
  return clusters.toArray(new ClusterBean[clusters.size()]);
}
Program: 115833
Project: 115833
Buggy source:
public CartridgeBean[] getAvailableMultiTenantCartridges() throws RestAPIException {
  int tenantId=getTenantId();
  if (!availableMultiTenantCartridges.containsKey(tenantId) && !availableMultiTenantCartridges.containsKey(PUBLIC_DEFINITION)) {
    return new HashMap<String,CartridgeBean>().values().toArray(new CartridgeBean[0]);
  }
  List<CartridgeBean> p=new ArrayList<CartridgeBean>();
  if (availableMultiTenantCartridges.get(tenantId) != null)   p.addAll(availableMultiTenantCartridges.get(tenantId).values());
  if (availableMultiTenantCartridges.get(PUBLIC_DEFINITION) != null)   p.addAll(availableMultiTenantCartridges.get(PUBLIC_DEFINITION).values());
  return p.toArray(new CartridgeBean[0]);
}

Fixed version (ground truth):
public CartridgeBean[] getAvailableMultiTenantCartridges() throws RestAPIException {
  int tenantId=getTenantId();
  if (!availableMultiTenantCartridges.containsKey(tenantId) && !availableMultiTenantCartridges.containsKey(PUBLIC_DEFINITION)) {
    Collection<CartridgeBean> cartridges=new HashMap<String,CartridgeBean>().values();
    return cartridges.toArray(new CartridgeBean[cartridges.size()]);
  }
  List<CartridgeBean> cartridges=new ArrayList<CartridgeBean>();
  if (availableMultiTenantCartridges.get(tenantId) != null)   cartridges.addAll(availableMultiTenantCartridges.get(tenantId).values());
  if (availableMultiTenantCartridges.get(PUBLIC_DEFINITION) != null)   cartridges.addAll(availableMultiTenantCartridges.get(PUBLIC_DEFINITION).values());
  return cartridges.toArray(new CartridgeBean[cartridges.size()]);
}
Program: 115834
Project: 115834
Buggy source:
public NetworkPartitionRefBean[] getPartitionGroups(String deploymentPolicyId) throws RestAPIException {
  int tenantId=getTenantId();
  if (!deploymentPolicyMap.containsKey(tenantId)) {
    if (!deploymentPolicyMap.containsKey(PUBLIC_DEFINITION)) {
      throw new RestAPIException(Status.NO_CONTENT,"String_Node_Str");
    }
 else {
      if (!(deploymentPolicyMap.get(PUBLIC_DEFINITION)).containsKey(deploymentPolicyId)) {
        throw new RestAPIException(Status.NO_CONTENT,"String_Node_Str" + deploymentPolicyId);
      }
      return (NetworkPartitionRefBean[])(deploymentPolicyMap.get(PUBLIC_DEFINITION)).get(deploymentPolicyId).getNetworkPartitions().toArray();
    }
  }
  if (!(deploymentPolicyMap.get(tenantId)).containsKey(deploymentPolicyId)) {
    throw new RestAPIException(Status.NO_CONTENT,"String_Node_Str" + deploymentPolicyId);
  }
  return (NetworkPartitionRefBean[])(deploymentPolicyMap.get(tenantId)).get(deploymentPolicyId).getNetworkPartitions().toArray();
}

Fixed version (ground truth):
public NetworkPartitionRefBean[] getPartitionGroups(String deploymentPolicyId) throws RestAPIException {
  int tenantId=getTenantId();
  if (!deploymentPolicyMap.containsKey(tenantId)) {
    if (!deploymentPolicyMap.containsKey(PUBLIC_DEFINITION)) {
      throw new RestAPIException(Status.NO_CONTENT,"String_Node_Str");
    }
 else {
      if (!(deploymentPolicyMap.get(PUBLIC_DEFINITION)).containsKey(deploymentPolicyId)) {
        throw new RestAPIException(Status.NO_CONTENT,"String_Node_Str" + deploymentPolicyId);
      }
      List<NetworkPartitionRefBean> networkPartitionsList=(deploymentPolicyMap.get(PUBLIC_DEFINITION)).get(deploymentPolicyId).getNetworkPartitions();
      return networkPartitionsList.toArray(new NetworkPartitionRefBean[networkPartitionsList.size()]);
    }
  }
  if (!(deploymentPolicyMap.get(tenantId)).containsKey(deploymentPolicyId)) {
    throw new RestAPIException(Status.NO_CONTENT,"String_Node_Str" + deploymentPolicyId);
  }
  List<NetworkPartitionRefBean> networkPartitionsList=(deploymentPolicyMap.get(tenantId)).get(deploymentPolicyId).getNetworkPartitions();
  return networkPartitionsList.toArray(new NetworkPartitionRefBean[networkPartitionsList.size()]);
}
Program: 115837
Project: 115837
Buggy source:
private static VolumeContext[] convertVolumeToStubVolume(List<VolumeBean> volumes){
  List<VolumeContext> volumeContexts=new ArrayList<VolumeContext>();
  for (  VolumeBean volumeBean : volumes) {
    VolumeContext volumeContext=new VolumeContext();
    volumeContext.setRemoveOntermination(volumeBean.isRemoveOnTermination());
    volumeContext.setVolumeId(volumeBean.getVolumeId());
    volumeContext.setMappingPath(volumeBean.getMappingPath());
    volumeContext.setDevice(volumeBean.getDevice());
    volumeContext.setSize(Integer.parseInt(volumeBean.getSize()));
    volumeContext.setSnapshotId(volumeBean.getSnapshotId());
    volumeContext.setId(volumeBean.getId());
    volumeContexts.add(volumeContext);
  }
  return (VolumeContext[])volumeContexts.toArray();
}

Fixed version (ground truth):
private static VolumeContext[] convertVolumeToStubVolume(List<VolumeBean> volumes){
  List<VolumeContext> volumeContexts=new ArrayList<VolumeContext>();
  for (  VolumeBean volumeBean : volumes) {
    VolumeContext volumeContext=new VolumeContext();
    volumeContext.setRemoveOntermination(volumeBean.isRemoveOnTermination());
    volumeContext.setVolumeId(volumeBean.getVolumeId());
    volumeContext.setMappingPath(volumeBean.getMappingPath());
    volumeContext.setDevice(volumeBean.getDevice());
    volumeContext.setSize(Integer.parseInt(volumeBean.getSize()));
    volumeContext.setSnapshotId(volumeBean.getSnapshotId());
    volumeContext.setId(volumeBean.getId());
    volumeContexts.add(volumeContext);
  }
  return volumeContexts.toArray(new VolumeContext[volumeContexts.size()]);
}