Program: 49033
Project: 49033
Buggy source:
public static void expandGroupInstanceType(NodeGroupEntity ngEntity,GroupType groupType,Set<String> sharedPattern,Set<String> localPattern){
  logger.debug("String_Node_Str" + ngEntity.getName());
  InstanceType instanceType=ngEntity.getNodeType();
  if (instanceType == null) {
    if (groupType == GroupType.MASTER_GROUP || groupType == GroupType.MASTER_JOBTRACKER_GROUP || groupType == GroupType.HBASE_MASTER_GROUP || groupType == GroupType.ZOOKEEPER_GROUP) {
      instanceType=InstanceType.MEDIUM;
    }
 else {
      instanceType=InstanceType.SMALL;
    }
  }
  logger.debug("String_Node_Str" + instanceType.toString());
  int memory=ngEntity.getMemorySize();
  if (memory <= 0) {
    ngEntity.setMemorySize(instanceType.getMemoryMB());
  }
  int cpu=ngEntity.getCpuNum();
  if (cpu <= 0) {
    ngEntity.setCpuNum(instanceType.getCpuNum());
  }
  if (ngEntity.getStorageSize() <= 0) {
    ngEntity.setStorageSize(getStorage(instanceType,groupType));
    logger.debug("String_Node_Str" + ngEntity.getStorageSize());
  }
 else {
    logger.debug("String_Node_Str" + ngEntity.getStorageSize());
  }
  if (ngEntity.getStorageType() == null) {
    DatastoreType storeType=groupType.getStorageEnumType();
    if ((sharedPattern == null || sharedPattern.isEmpty()) && storeType == DatastoreType.SHARED) {
      storeType=DatastoreType.LOCAL;
    }
    if ((localPattern == null || localPattern.isEmpty()) && storeType == DatastoreType.LOCAL) {
      storeType=DatastoreType.SHARED;
    }
    ngEntity.setStorageType(storeType);
  }
  if (groupType == GroupType.ZOOKEEPER_GROUP) {
    ngEntity.setDiskBisect(true);
  }
 else {
    ngEntity.setDiskBisect(false);
  }
}

Fixed version (ground truth):
public static void expandGroupInstanceType(NodeGroupEntity ngEntity,GroupType groupType,Set<String> sharedPattern,Set<String> localPattern){
  logger.debug("String_Node_Str" + ngEntity.getName());
  InstanceType instanceType=ngEntity.getNodeType();
  if (instanceType == null) {
    if (groupType == GroupType.MASTER_GROUP || groupType == GroupType.MASTER_JOBTRACKER_GROUP || groupType == GroupType.HBASE_MASTER_GROUP || groupType == GroupType.ZOOKEEPER_GROUP) {
      instanceType=InstanceType.MEDIUM;
    }
 else {
      instanceType=InstanceType.SMALL;
    }
  }
  logger.debug("String_Node_Str" + instanceType.toString());
  int memory=ngEntity.getMemorySize();
  if (memory <= 0) {
    ngEntity.setMemorySize(instanceType.getMemoryMB());
  }
  int cpu=ngEntity.getCpuNum();
  if (cpu <= 0) {
    ngEntity.setCpuNum(instanceType.getCpuNum());
  }
  if (ngEntity.getStorageSize() <= 0) {
    ngEntity.setStorageSize(getStorage(instanceType,groupType));
    logger.debug("String_Node_Str" + ngEntity.getStorageSize());
  }
 else {
    logger.debug("String_Node_Str" + ngEntity.getStorageSize());
  }
  if (ngEntity.getStorageType() == null) {
    DatastoreType storeType=groupType.getStorageEnumType();
    if ((sharedPattern == null || sharedPattern.isEmpty()) && storeType == DatastoreType.SHARED) {
      storeType=DatastoreType.LOCAL;
    }
    if ((localPattern == null || localPattern.isEmpty()) && storeType == DatastoreType.LOCAL) {
      storeType=DatastoreType.SHARED;
    }
    ngEntity.setStorageType(storeType);
  }
 else {
    if ((sharedPattern == null || sharedPattern.isEmpty()) && (ngEntity.getStorageType().equals(DatastoreType.SHARED))) {
      String msg="String_Node_Str" + ngEntity.getName() + "String_Node_Str";
      logger.error(msg);
      throw ClusterConfigException.CLUSTER_CONFIG_DATASTORE_TYPE_NONEXISTENT(msg);
    }
    if ((localPattern == null || localPattern.isEmpty()) && (ngEntity.getStorageType().equals(DatastoreType.LOCAL))) {
      String msg="String_Node_Str" + ngEntity.getName() + "String_Node_Str";
      logger.error(msg);
      throw ClusterConfigException.CLUSTER_CONFIG_DATASTORE_TYPE_NONEXISTENT(msg);
    }
  }
  if (groupType == GroupType.ZOOKEEPER_GROUP) {
    ngEntity.setDiskBisect(true);
  }
 else {
    ngEntity.setDiskBisect(false);
  }
}