Program: 7242
Project: 7242
Buggy source:
/** 
 * This task wraps around the code necessary to checkout Integrity CM Members on remote machines
 */
public Boolean invoke(File workspaceFile,VirtualChannel channel) throws IOException {
  File checkOutDir=(null != alternateWorkspaceDir && alternateWorkspaceDir.length() > 0) ? new File(alternateWorkspaceDir) : workspaceFile;
  FilePath workspace=new FilePath(checkOutDir.isAbsolute() ? checkOutDir : new File(workspaceFile.getAbsolutePath() + IntegritySCM.FS + checkOutDir.getPath()));
  listener.getLogger().println("String_Node_Str" + workspace);
  final ThreadLocalAPISession generateAPISession=new ThreadLocalAPISession(integrityConfig);
  final ThreadLocalOpenFileHandler openFileHandler=new ThreadLocalOpenFileHandler();
  ExecutorService executor=Executors.newFixedThreadPool(checkoutThreadPoolSize);
  @SuppressWarnings("String_Node_Str") final List<Future> coThreads=new ArrayList<Future>();
  try {
    if (cleanCopy) {
      listener.getLogger().println("String_Node_Str" + workspace);
      Logger.debug("String_Node_Str" + workspace);
      workspace.deleteContents();
      listener.getLogger().println("String_Node_Str");
    }
    createFolderStructure(workspace);
    for (Iterator<Hashtable<CM_PROJECT,Object>> it=projectMembersList.iterator(); it.hasNext(); ) {
      Hashtable<CM_PROJECT,Object> memberInfo=it.next();
      short deltaFlag=(null == memberInfo.get(CM_PROJECT.DELTA) ? -1 : Short.valueOf(memberInfo.get(CM_PROJECT.DELTA).toString()));
      File targetFile=new File(workspace + memberInfo.get(CM_PROJECT.RELATIVE_FILE).toString());
      String memberName=memberInfo.get(CM_PROJECT.NAME).toString();
      String memberID=memberInfo.get(CM_PROJECT.MEMBER_ID).toString();
      String memberRev=memberInfo.get(CM_PROJECT.REVISION).toString();
      String configPath=memberInfo.get(CM_PROJECT.CONFIG_PATH).toString();
      String checksum=(null == memberInfo.get(CM_PROJECT.CHECKSUM) ? "String_Node_Str" : memberInfo.get(CM_PROJECT.CHECKSUM).toString());
      if (cleanCopy && deltaFlag != 3) {
        Logger.debug("String_Node_Str" + targetFile.getAbsolutePath() + "String_Node_Str"+ memberRev);
        coThreads.add(executor.submit(new CheckOutTask(generateAPISession,openFileHandler,memberName,configPath,memberID,memberRev,targetFile,fetchChangedWorkspaceFiles)));
      }
 else       if (deltaFlag == 0 && fetchChangedWorkspaceFiles && checksum.length() > 0) {
        if (!checksum.equals(IntegrityCMMember.getMD5Checksum(targetFile))) {
          Logger.debug("String_Node_Str" + targetFile.getAbsolutePath() + "String_Node_Str"+ memberRev);
          coThreads.add(executor.submit(new CheckOutTask(generateAPISession,openFileHandler,memberName,configPath,memberID,memberRev,targetFile,false)));
          fetchCount++;
        }
      }
 else       if (deltaFlag == 1) {
        Logger.debug("String_Node_Str" + targetFile.getAbsolutePath() + "String_Node_Str"+ memberRev);
        coThreads.add(executor.submit(new CheckOutTask(generateAPISession,openFileHandler,memberName,configPath,memberID,memberRev,targetFile,fetchChangedWorkspaceFiles)));
        addCount++;
      }
 else       if (deltaFlag == 2) {
        Logger.debug("String_Node_Str" + targetFile.getAbsolutePath() + "String_Node_Str"+ memberRev);
        coThreads.add(executor.submit(new CheckOutTask(generateAPISession,openFileHandler,memberName,configPath,memberID,memberRev,targetFile,fetchChangedWorkspaceFiles)));
        updateCount++;
      }
 else       if (deltaFlag == 3) {
        Logger.debug("String_Node_Str" + targetFile.getAbsolutePath() + "String_Node_Str"+ memberRev);
        dropCount++;
        if (targetFile.exists() && !targetFile.delete()) {
          listener.getLogger().println("String_Node_Str" + targetFile.getAbsolutePath() + "String_Node_Str");
          return false;
        }
      }
    }
    int checkoutMembers=0;
    int previousCount=0;
    int canceledMembers=0;
    int totalMembers=coThreads.size();
    while (!coThreads.isEmpty()) {
      @SuppressWarnings("String_Node_Str") Iterator<Future> iter=coThreads.iterator();
      while (iter.hasNext()) {
        Future<?> future=iter.next();
        if (future.isCancelled()) {
          listener.getLogger().println("String_Node_Str" + future.toString() + "String_Node_Str");
          canceledMembers++;
          iter.remove();
        }
 else         if (future.isDone()) {
          checkoutMembers++;
          iter.remove();
        }
      }
      if (previousCount != (checkoutMembers + canceledMembers)) {
        Logger.debug("String_Node_Str" + checkoutMembers + "String_Node_Str"+ totalMembers+ (canceledMembers > 0 ? "String_Node_Str" + canceledMembers + "String_Node_Str" : "String_Node_Str"));
      }
      previousCount=checkoutMembers + canceledMembers;
      Thread.sleep(2000);
    }
    executor.shutdown();
    executor.awaitTermination(2,TimeUnit.MINUTES);
    if (cleanCopy) {
      listener.getLogger().println("String_Node_Str" + projectMembersList.size() + "String_Node_Str");
    }
 else {
      listener.getLogger().println("String_Node_Str" + (addCount + updateCount) + "String_Node_Str"+ dropCount+ "String_Node_Str");
      if (fetchChangedWorkspaceFiles && fetchCount > 0) {
        listener.getLogger().println("String_Node_Str" + fetchCount + "String_Node_Str");
      }
    }
  }
 catch (  InterruptedException iex) {
    Logger.error("String_Node_Str");
    listener.getLogger().println("String_Node_Str");
    Logger.error(iex.getMessage());
    listener.getLogger().println(iex.getMessage());
    listener.getLogger().println("String_Node_Str" + workspace + "String_Node_Str");
    return false;
  }
 finally {
    if (generateAPISession != null) {
      generateAPISession.remove();
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * This task wraps around the code necessary to checkout Integrity CM Members on remote machines
 */
public Boolean invoke(File workspaceFile,VirtualChannel channel) throws IOException {
  File checkOutDir=(null != alternateWorkspaceDir && alternateWorkspaceDir.length() > 0) ? new File(alternateWorkspaceDir) : workspaceFile;
  FilePath workspace=new FilePath(checkOutDir.isAbsolute() ? checkOutDir : new File(workspaceFile.getAbsolutePath() + IntegritySCM.FS + checkOutDir.getPath()));
  listener.getLogger().println("String_Node_Str" + workspace);
  final ThreadLocalAPISession generateAPISession=new ThreadLocalAPISession(integrityConfig);
  final ThreadLocalOpenFileHandler openFileHandler=new ThreadLocalOpenFileHandler();
  ExecutorService executor=Executors.newFixedThreadPool(checkoutThreadPoolSize);
  @SuppressWarnings("String_Node_Str") final List<Future> coThreads=new ArrayList<Future>();
  try {
    if (cleanCopy) {
      listener.getLogger().println("String_Node_Str" + workspace);
      Logger.debug("String_Node_Str" + workspace);
      workspace.deleteContents();
      listener.getLogger().println("String_Node_Str");
    }
    createFolderStructure(workspace);
    for (Iterator<Hashtable<CM_PROJECT,Object>> it=projectMembersList.iterator(); it.hasNext(); ) {
      Hashtable<CM_PROJECT,Object> memberInfo=it.next();
      short deltaFlag=(null == memberInfo.get(CM_PROJECT.DELTA) ? -1 : Short.valueOf(memberInfo.get(CM_PROJECT.DELTA).toString()));
      File targetFile=new File(workspace + memberInfo.get(CM_PROJECT.RELATIVE_FILE).toString());
      String memberName=memberInfo.get(CM_PROJECT.NAME).toString();
      String memberID=memberInfo.get(CM_PROJECT.MEMBER_ID).toString();
      String memberRev=memberInfo.get(CM_PROJECT.REVISION).toString();
      String configPath=memberInfo.get(CM_PROJECT.CONFIG_PATH).toString();
      String checksum=(null == memberInfo.get(CM_PROJECT.CHECKSUM) ? "String_Node_Str" : memberInfo.get(CM_PROJECT.CHECKSUM).toString());
      if (cleanCopy && deltaFlag != 3) {
        Logger.debug("String_Node_Str" + targetFile.getAbsolutePath() + "String_Node_Str"+ memberRev);
        coThreads.add(executor.submit(new CheckOutTask(generateAPISession,openFileHandler,memberName,configPath,memberID,memberRev,targetFile,fetchChangedWorkspaceFiles)));
      }
 else       if (deltaFlag == 0 && fetchChangedWorkspaceFiles && checksum.length() > 0) {
        if (!checksum.equals(IntegrityCMMember.getMD5Checksum(targetFile))) {
          Logger.debug("String_Node_Str" + targetFile.getAbsolutePath() + "String_Node_Str"+ memberRev);
          coThreads.add(executor.submit(new CheckOutTask(generateAPISession,openFileHandler,memberName,configPath,memberID,memberRev,targetFile,false)));
          fetchCount++;
        }
      }
 else       if (deltaFlag == 1) {
        Logger.debug("String_Node_Str" + targetFile.getAbsolutePath() + "String_Node_Str"+ memberRev);
        coThreads.add(executor.submit(new CheckOutTask(generateAPISession,openFileHandler,memberName,configPath,memberID,memberRev,targetFile,fetchChangedWorkspaceFiles)));
        addCount++;
      }
 else       if (deltaFlag == 2) {
        Logger.debug("String_Node_Str" + targetFile.getAbsolutePath() + "String_Node_Str"+ memberRev);
        coThreads.add(executor.submit(new CheckOutTask(generateAPISession,openFileHandler,memberName,configPath,memberID,memberRev,targetFile,fetchChangedWorkspaceFiles)));
        updateCount++;
      }
 else       if (deltaFlag == 3) {
        Logger.debug("String_Node_Str" + targetFile.getAbsolutePath() + "String_Node_Str"+ memberRev);
        dropCount++;
        if (targetFile.exists() && !targetFile.delete()) {
          listener.getLogger().println("String_Node_Str" + targetFile.getAbsolutePath() + "String_Node_Str");
          return false;
        }
      }
    }
    int checkoutMembers=0;
    int previousCount=0;
    int canceledMembers=0;
    int totalMembers=coThreads.size();
    while (!coThreads.isEmpty()) {
      @SuppressWarnings("String_Node_Str") Iterator<Future> iter=coThreads.iterator();
      while (iter.hasNext()) {
        Future<?> future=iter.next();
        if (future.isCancelled()) {
          listener.getLogger().println("String_Node_Str" + future.toString() + "String_Node_Str");
          canceledMembers++;
          iter.remove();
        }
 else         if (future.isDone()) {
          try {
            future.get();
          }
 catch (          ExecutionException e) {
            listener.getLogger().println(e.getMessage());
            Logger.error(e);
            StackTraceElement[] st=e.getStackTrace();
            for (int i=0; i < st.length; i++) {
              Logger.error("String_Node_Str" + st[i].getClassName() + "String_Node_Str"+ st[i].getMethodName()+ "String_Node_Str"+ st[i].getFileName()+ "String_Node_Str"+ st[i].getLineNumber()+ "String_Node_Str");
            }
            return false;
          }
          checkoutMembers++;
          iter.remove();
        }
      }
      if (previousCount != (checkoutMembers + canceledMembers)) {
        Logger.debug("String_Node_Str" + checkoutMembers + "String_Node_Str"+ totalMembers+ (canceledMembers > 0 ? "String_Node_Str" + canceledMembers + "String_Node_Str" : "String_Node_Str"));
      }
      previousCount=checkoutMembers + canceledMembers;
      Thread.sleep(2000);
    }
    executor.shutdown();
    executor.awaitTermination(2,TimeUnit.MINUTES);
    if (cleanCopy) {
      listener.getLogger().println("String_Node_Str" + projectMembersList.size() + "String_Node_Str");
    }
 else {
      listener.getLogger().println("String_Node_Str" + (addCount + updateCount) + "String_Node_Str"+ dropCount+ "String_Node_Str");
      if (fetchChangedWorkspaceFiles && fetchCount > 0) {
        listener.getLogger().println("String_Node_Str" + fetchCount + "String_Node_Str");
      }
    }
  }
 catch (  InterruptedException iex) {
    Logger.error("String_Node_Str");
    listener.getLogger().println("String_Node_Str");
    Logger.error(iex.getMessage());
    listener.getLogger().println(iex.getMessage());
    listener.getLogger().println("String_Node_Str" + workspace + "String_Node_Str");
    return false;
  }
 finally {
    if (generateAPISession != null) {
      generateAPISession.remove();
    }
  }
  return true;
}