Program: 116193
Project: 116193
Buggy source:
/** 
 * This will start the group instance based on the given parent instanceId A new monitor is not created in this case
 * @param group
 * @param parentInstanceId
 * @throws org.apache.stratos.autoscaler.exception.application.MonitorNotFoundException
 */
public void createInstanceAndStartDependencyOnScaleup(Group group,String parentInstanceId) throws MonitorNotFoundException {
  Instance parentInstanceContext=getParentInstanceContext(parentInstanceId);
  GroupLevelNetworkPartitionContext groupLevelNetworkPartitionContext=getGroupLevelNetworkPartitionContext(group.getUniqueIdentifier(),this.appId,parentInstanceContext);
  addPartitionContext(parentInstanceContext,groupLevelNetworkPartitionContext);
  String groupInstanceId;
  PartitionContext partitionContext;
  String parentPartitionId=parentInstanceContext.getPartitionId();
  int groupMax=groupLevelNetworkPartitionContext.getMaxInstanceCount();
  if (group.getInstanceContextCount() < groupMax) {
    if (parentPartitionId == null) {
      AutoscaleAlgorithm algorithm=this.getAutoscaleAlgorithm(groupLevelNetworkPartitionContext.getPartitionAlgorithm());
      partitionContext=algorithm.getNextScaleUpPartitionContext((PartitionContext[])groupLevelNetworkPartitionContext.getPartitionCtxts().toArray());
    }
 else {
      partitionContext=groupLevelNetworkPartitionContext.getPartitionContextById(parentPartitionId);
    }
    groupInstanceId=createGroupInstanceAndAddToMonitor(group,parentInstanceContext,partitionContext,groupLevelNetworkPartitionContext,null);
    startDependency(group,groupInstanceId);
  }
 else {
    log.warn("String_Node_Str" + group.getUniqueIdentifier() + "String_Node_Str"+ "String_Node_Str"+ groupMax+ "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * This will start the group instance based on the given parent instanceId A new monitor is not created in this case
 * @param group
 * @param parentInstanceId
 * @throws org.apache.stratos.autoscaler.exception.application.MonitorNotFoundException
 */
public void createInstanceAndStartDependencyOnScaleup(Group group,String parentInstanceId) throws MonitorNotFoundException {
  Instance parentInstanceContext=getParentInstanceContext(parentInstanceId);
  GroupLevelNetworkPartitionContext groupLevelNetworkPartitionContext=getGroupLevelNetworkPartitionContext(group.getUniqueIdentifier(),this.appId,parentInstanceContext);
  addPartitionContext(parentInstanceContext,groupLevelNetworkPartitionContext);
  String groupInstanceId;
  PartitionContext partitionContext;
  String parentPartitionId=parentInstanceContext.getPartitionId();
  int groupMax=group.getGroupMaxInstances();
  if (group.getInstanceContextCount() < groupMax) {
    if (parentPartitionId == null) {
      AutoscaleAlgorithm algorithm=this.getAutoscaleAlgorithm(groupLevelNetworkPartitionContext.getPartitionAlgorithm());
      partitionContext=algorithm.getNextScaleUpPartitionContext((PartitionContext[])groupLevelNetworkPartitionContext.getPartitionCtxts().toArray());
    }
 else {
      partitionContext=groupLevelNetworkPartitionContext.getPartitionContextById(parentPartitionId);
    }
    if (partitionContext != null) {
      groupInstanceId=createGroupInstanceAndAddToMonitor(group,parentInstanceContext,partitionContext,groupLevelNetworkPartitionContext,null);
      startDependency(group,groupInstanceId);
    }
 else {
      log.warn("String_Node_Str" + group.getUniqueIdentifier() + "String_Node_Str"+ "String_Node_Str"+ groupMax+ "String_Node_Str");
    }
  }
 else {
    log.warn("String_Node_Str" + group.getUniqueIdentifier() + "String_Node_Str"+ "String_Node_Str"+ groupMax+ "String_Node_Str");
  }
}