Program: 115779
Project: 115779
Buggy source:
public void handleApplicationBursting() throws TopologyInConsistentException, PolicyValidationException, MonitorNotFoundException {
  Application application=ApplicationHolder.getApplications().getApplication(appId);
  if (application == null) {
    String msg="String_Node_Str";
    throw new TopologyInConsistentException(msg);
  }
  boolean burstNPFound=false;
  String instanceId=null;
  ApplicationPolicy applicationPolicy=PolicyManager.getInstance().getApplicationPolicy(application.getApplicationPolicyId());
  if (applicationPolicy == null) {
    String msg=String.format("String_Node_Str",appId);
    log.error(msg);
    throw new RuntimeException(msg);
  }
  NetworkPartitionAlgorithmContext algorithmContext=AutoscalerContext.getInstance().getNetworkPartitionAlgorithmContext(appId);
  if (algorithmContext == null) {
    String msg=String.format("String_Node_Str",appId);
    log.error(msg);
    throw new RuntimeException(msg);
  }
  String networkPartitionAlgorithmName=applicationPolicy.getAlgorithm();
  if (log.isDebugEnabled()) {
    String msg=String.format("String_Node_Str",networkPartitionAlgorithmName,appId);
    log.debug(msg);
  }
  NetworkPartitionAlgorithm algorithm=getNetworkPartitionAlgorithm(networkPartitionAlgorithmName);
  if (algorithm == null) {
    String msg=String.format("String_Node_Str",appId);
    log.error(msg);
    throw new RuntimeException(msg);
  }
  List<String> nextNetworkPartitions=algorithm.getNextNetworkPartitions(algorithmContext);
  if (nextNetworkPartitions == null || nextNetworkPartitions.isEmpty()) {
    String msg=String.format("String_Node_Str",appId);
    log.warn(msg);
    return;
  }
  for (  String networkPartitionId : nextNetworkPartitions) {
    if (!this.getNetworkPartitionCtxts().containsKey(networkPartitionId)) {
      ApplicationLevelNetworkPartitionContext context=new ApplicationLevelNetworkPartitionContext(networkPartitionId);
      context.setCreatedOnBurst(true);
      ApplicationInstance appInstance=(ApplicationInstance)application.getInstanceByNetworkPartitionId(context.getId());
      if (appInstance == null) {
        instanceId=handleApplicationInstanceCreation(application,context,null);
      }
 else {
        log.warn("String_Node_Str" + "String_Node_Str" + appInstance.getInstanceId() + "String_Node_Str");
        instanceId=handleApplicationInstanceCreation(application,context,appInstance);
      }
      burstNPFound=true;
    }
  }
  if (!burstNPFound) {
    log.warn("String_Node_Str" + appId + "String_Node_Str");
  }
 else {
    startDependency(application,instanceId);
  }
}

Fixed version (ground truth):
/** 
 * Handling the application bursting into available network partition
 * @throws TopologyInConsistentException
 * @throws PolicyValidationException
 * @throws MonitorNotFoundException
 */
public void handleApplicationBursting() throws TopologyInConsistentException, PolicyValidationException, MonitorNotFoundException {
  Application application=ApplicationHolder.getApplications().getApplication(appId);
  if (application == null) {
    String msg="String_Node_Str";
    throw new TopologyInConsistentException(msg);
  }
  boolean burstNPFound=false;
  String instanceId=null;
  ApplicationPolicy applicationPolicy=PolicyManager.getInstance().getApplicationPolicy(application.getApplicationPolicyId());
  if (applicationPolicy == null) {
    String msg=String.format("String_Node_Str" + "String_Node_Str",appId);
    log.error(msg);
    throw new RuntimeException(msg);
  }
  NetworkPartitionAlgorithmContext algorithmContext=AutoscalerContext.getInstance().getNetworkPartitionAlgorithmContext(appId);
  if (algorithmContext == null) {
    String msg=String.format("String_Node_Str" + "String_Node_Str",appId);
    log.error(msg);
    throw new RuntimeException(msg);
  }
  String networkPartitionAlgorithmName=applicationPolicy.getAlgorithm();
  if (log.isDebugEnabled()) {
    String msg=String.format("String_Node_Str",networkPartitionAlgorithmName,appId);
    log.debug(msg);
  }
  NetworkPartitionAlgorithm algorithm=getNetworkPartitionAlgorithm(networkPartitionAlgorithmName);
  if (algorithm == null) {
    String msg=String.format("String_Node_Str" + "String_Node_Str",appId);
    log.error(msg);
    throw new RuntimeException(msg);
  }
  List<String> nextNetworkPartitions=algorithm.getNextNetworkPartitions(algorithmContext);
  if (nextNetworkPartitions == null || nextNetworkPartitions.isEmpty()) {
    String msg=String.format("String_Node_Str" + "String_Node_Str",appId);
    log.warn(msg);
    return;
  }
  for (  String networkPartitionId : nextNetworkPartitions) {
    if (!this.getNetworkPartitionCtxts().containsKey(networkPartitionId)) {
      ApplicationLevelNetworkPartitionContext context=new ApplicationLevelNetworkPartitionContext(networkPartitionId);
      context.setCreatedOnBurst(true);
      ApplicationInstance appInstance=(ApplicationInstance)application.getInstanceByNetworkPartitionId(context.getId());
      if (appInstance == null) {
        instanceId=handleApplicationInstanceCreation(application,context,null);
      }
 else {
        log.warn("String_Node_Str" + "String_Node_Str" + appInstance.getInstanceId() + "String_Node_Str");
        instanceId=handleApplicationInstanceCreation(application,context,appInstance);
      }
      burstNPFound=true;
    }
  }
  if (!burstNPFound) {
    log.warn("String_Node_Str" + appId + "String_Node_Str");
  }
 else {
    startDependency(application,instanceId);
  }
}