Program: 62243
Project: 62243
Buggy source:
/** 
 * Override the content of an archive from a full exising archive.
 * @param topologyId The if of the topology to process.
 * @param inputStream The input stream of the file that contains the archive.
 */
public void override(String topologyId,InputStream inputStream) throws IOException {
  Path tempPath=null;
  try {
    initContext(topologyId,(String)null);
    tempPath=Files.createTempFile(tempUploadDir,null,null);
    Files.copy(inputStream,tempPath,StandardCopyOption.REPLACE_EXISTING);
    topologyUploadService.processTopology(tempPath,EditionContextManager.get().getTopology().getWorkspace());
    FileUtil.delete(EditionContextManager.get().getLocalGitPath(),EditionContextManager.get().getLocalGitPath().resolve("String_Node_Str"));
    if (isZipFile(tempPath)) {
      FileUtil.unzip(tempPath,EditionContextManager.get().getLocalGitPath());
    }
 else {
      Path targetPath=EditionContextManager.get().getLocalGitPath().resolve(tempPath.getFileName());
      Files.copy(tempPath,targetPath,StandardCopyOption.REPLACE_EXISTING);
    }
    Topology topology=EditionContextManager.getTopology();
    String commitMessage=AuthorizationUtil.getCurrentUser().getUserId() + "String_Node_Str";
    topologyServiceCore.save(topology);
    topologySubstitutionServive.updateSubstitutionType(topology,EditionContextManager.getCsar());
    repositoryService.commit(EditionContextManager.get().getCsar(),commitMessage);
  }
  finally {
    EditionContextManager.get().setCurrentOperation(null);
    editionContextManager.destroy();
  }
}

Fixed version (ground truth):
/** 
 * Override the content of an archive from a full exising archive.
 * @param topologyId The if of the topology to process.
 * @param inputStream The input stream of the file that contains the archive.
 */
public void override(String topologyId,InputStream inputStream) throws IOException {
  Path tempPath=null;
  try {
    initContext(topologyId,(String)null);
    tempPath=Files.createTempFile(tempUploadDir,null,null);
    Files.copy(inputStream,tempPath,StandardCopyOption.REPLACE_EXISTING);
    topologyUploadService.processTopology(tempPath,EditionContextManager.get().getTopology().getWorkspace());
    FileUtil.delete(EditionContextManager.get().getLocalGitPath(),EditionContextManager.get().getLocalGitPath().resolve("String_Node_Str"));
    if (isZipFile(tempPath)) {
      FileUtil.unzip(tempPath,EditionContextManager.get().getLocalGitPath());
    }
 else {
      Path targetPath=EditionContextManager.get().getLocalGitPath().resolve(tempPath.getFileName());
      Files.copy(tempPath,targetPath,StandardCopyOption.REPLACE_EXISTING);
    }
    Topology topology=EditionContextManager.getTopology();
    String commitMessage=AuthorizationUtil.getCurrentUser().getUserId() + "String_Node_Str";
    topologyServiceCore.save(topology);
    csarService.setDependencies(topology.getId(),topology.getDependencies());
    topologySubstitutionServive.updateSubstitutionType(topology,EditionContextManager.getCsar());
    repositoryService.commit(EditionContextManager.get().getCsar(),commitMessage);
  }
  finally {
    EditionContextManager.get().setCurrentOperation(null);
    editionContextManager.destroy();
  }
}