Program: 115508
Project: 115508
Buggy source:
/** 
 * Remove Service Group
 * @param name Group Name
 * @throws RestAPIException
 */
public static void removeServiceGroup(String name,int tenantId) throws RestAPIException, AutoscalerServiceCartridgeGroupNotFoundExceptionException, CloudControllerServiceCartridgeNotFoundExceptionException {
  AutoscalerServiceClient asServiceClient=getAutoscalerServiceClient();
  StratosManagerServiceClient smServiceClient=getStratosManagerServiceClient();
  if (log.isDebugEnabled()) {
    log.debug(String.format("String_Node_Str",name,tenantId));
  }
  String serviceGroupUuid=null;
  try {
    ServiceGroup serviceGroup=asServiceClient.getServiceGroupByTenant(name,tenantId);
    if (serviceGroup == null) {
      String message="String_Node_Str" + name + "String_Node_Str"+ "String_Node_Str"+ tenantId;
      log.error(message);
      throw new RestAPIException(message);
    }
    if (!smServiceClient.canCartirdgeGroupBeRemoved(serviceGroup.getUuid())) {
      String message=String.format("String_Node_Str" + "String_Node_Str",serviceGroup.getUuid(),serviceGroup.getName(),tenantId);
      log.error(message);
      throw new RestAPIException(message);
    }
    serviceGroupUuid=serviceGroup.getUuid();
    asServiceClient.undeployServiceGroupDefinition(serviceGroup.getUuid());
    List<String> cartridgeList=new ArrayList<String>();
    findCartridgesInServiceGroup(serviceGroup,cartridgeList);
    String[] cartridgeNames=cartridgeList.toArray(new String[cartridgeList.size()]);
    smServiceClient.removeUsedCartridgesInCartridgeGroups(serviceGroupUuid,cartridgeNames);
  }
 catch (  RemoteException e) {
    throw new RestAPIException("String_Node_Str",e);
  }
  log.info(String.format("String_Node_Str" + "String_Node_Str",serviceGroupUuid,name));
}

Fixed version (ground truth):
/** 
 * Remove Service Group
 * @param name Group Name
 * @throws RestAPIException
 */
public static void removeServiceGroup(String name,int tenantId) throws RestAPIException, AutoscalerServiceCartridgeGroupNotFoundExceptionException, CloudControllerServiceCartridgeNotFoundExceptionException {
  AutoscalerServiceClient asServiceClient=getAutoscalerServiceClient();
  StratosManagerServiceClient smServiceClient=getStratosManagerServiceClient();
  if (log.isDebugEnabled()) {
    log.debug(String.format("String_Node_Str",name,tenantId));
  }
  String serviceGroupUuid;
  try {
    ServiceGroup serviceGroup=asServiceClient.getServiceGroupByTenant(name,tenantId);
    if (serviceGroup == null) {
      String message="String_Node_Str" + name + "String_Node_Str"+ "String_Node_Str"+ tenantId;
      log.error(message);
      throw new RestAPIException(message);
    }
    if (!smServiceClient.canCartirdgeGroupBeRemoved(serviceGroup.getUuid())) {
      String message=String.format("String_Node_Str" + "String_Node_Str",serviceGroup.getUuid(),serviceGroup.getName(),tenantId);
      log.error(message);
      throw new RestAPIException(message);
    }
    serviceGroupUuid=serviceGroup.getUuid();
    asServiceClient.undeployServiceGroupDefinition(serviceGroup.getUuid());
    List<String> cartridgeList=new ArrayList<String>();
    findCartridgesInServiceGroup(serviceGroup,cartridgeList);
    String[] cartridgeNames=cartridgeList.toArray(new String[cartridgeList.size()]);
    smServiceClient.removeUsedCartridgesInCartridgeGroups(serviceGroupUuid,cartridgeNames);
  }
 catch (  RemoteException e) {
    throw new RestAPIException("String_Node_Str",e);
  }
  log.info(String.format("String_Node_Str" + "String_Node_Str",serviceGroupUuid,name));
}