Program: 48834
Project: 48834
Buggy source:
/** 
 * this method will delete the cluster root folder, if there is any VM existed and powered on in the folder, the folder deletion will fail.
 * @param node
 * @throws BddException
 */
private void deleteFolders(BaseNode node) throws BddException {
  String path=node.getVmFolder();
  String[] folderNames=path.split("String_Node_Str");
  AuAssert.check(folderNames.length == 3);
  VcDatacenter dc=templateVm.getDatacenter();
  List<String> deletedFolders=new ArrayList<String>();
  deletedFolders.add(folderNames[0]);
  deletedFolders.add(folderNames[1]);
  Folder folder=null;
  try {
    folder=VcResourceUtils.findFolderByNameList(dc,deletedFolders);
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    throw BddException.INTERNAL(e,e.getMessage());
  }
  String clusterFolderName=folderNames[0] + "String_Node_Str" + folderNames[1];
  logger.info("String_Node_Str" + clusterFolderName);
  List<Folder> folders=new ArrayList<Folder>();
  folders.add(folder);
  DeleteVMFolderSP sp=new DeleteVMFolderSP(folders,true,false);
  Callable<Void>[] storedProcedures=new Callable[1];
  storedProcedures[0]=sp;
  try {
    NoProgressUpdateCallback callback=new NoProgressUpdateCallback();
    ExecutionResult[] result=Scheduler.executeStoredProcedures(com.vmware.aurora.composition.concurrent.Priority.BACKGROUND,storedProcedures,callback);
    if (result == null || result.length == 0) {
      logger.error("String_Node_Str");
      return;
    }
    if (result[0].finished && result[0].throwable == null) {
      logger.info("String_Node_Str" + clusterFolderName + "String_Node_Str");
    }
 else {
      logger.info("String_Node_Str" + clusterFolderName,result[0].throwable);
    }
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    throw BddException.INTERNAL(e,e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * this method will delete the cluster root folder, if there is any VM existed and powered on in the folder, the folder deletion will fail.
 * @param node
 * @throws BddException
 */
private void deleteFolders(BaseNode node) throws BddException {
  String path=node.getVmFolder();
  String[] folderNames=path.split("String_Node_Str");
  AuAssert.check(folderNames.length == 3);
  VcDatacenter dc=templateVm.getDatacenter();
  List<String> deletedFolders=new ArrayList<String>();
  deletedFolders.add(folderNames[0]);
  deletedFolders.add(folderNames[1]);
  Folder folder=null;
  try {
    folder=VcResourceUtils.findFolderByNameList(dc,deletedFolders);
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    throw BddException.INTERNAL(e,e.getMessage());
  }
  if (folder == null) {
    logger.info("String_Node_Str");
  }
  String clusterFolderName=folderNames[0] + "String_Node_Str" + folderNames[1];
  logger.info("String_Node_Str" + clusterFolderName);
  List<Folder> folders=new ArrayList<Folder>();
  folders.add(folder);
  DeleteVMFolderSP sp=new DeleteVMFolderSP(folders,true,false);
  Callable<Void>[] storedProcedures=new Callable[1];
  storedProcedures[0]=sp;
  try {
    NoProgressUpdateCallback callback=new NoProgressUpdateCallback();
    ExecutionResult[] result=Scheduler.executeStoredProcedures(com.vmware.aurora.composition.concurrent.Priority.BACKGROUND,storedProcedures,callback);
    if (result == null || result.length == 0) {
      logger.error("String_Node_Str");
      return;
    }
    if (result[0].finished && result[0].throwable == null) {
      logger.info("String_Node_Str" + clusterFolderName + "String_Node_Str");
    }
 else {
      logger.info("String_Node_Str" + clusterFolderName,result[0].throwable);
    }
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    throw BddException.INTERNAL(e,e.getMessage());
  }
}