Program: 139125
Project: 139125
Buggy source:
private void downloadExtension(IEcosComponent extension,IProgressMonitor monitor){
  String componentUrl=extension.getLatestRevision().getUrl();
  monitor.setTaskName(EcosConstants.DOWNLOAD_TASK_NAME + componentUrl);
  String targetFolder=ResourceManager.getExchangeFolder().getLocation().toOSString();
  try {
    String fileName=extension.getLatestRevision().getFileName();
    File localZipFile=new File(targetFolder,fileName);
    if (extension.getInstalledLocation() != null && extension.getInstalledRevision() != null) {
      if (extension.getInstalledRevision().getName().equals(extension.getLatestRevision().getName())) {
        if (localZipFile.exists() && checkIfExisted(extension.getInstalledLocation())) {
          monitor.done();
          Display.getDefault().asyncExec(new Runnable(){
            public void run(){
              MessageDialogWithToggle.openInformation(null,DefaultMessagesImpl.getString("String_Node_Str"),DefaultMessagesImpl.getString("String_Node_Str"));
            }
          }
);
          return;
        }
      }
 else {
        FileUtils.deleteDirectory(new File(extension.getInstalledLocation()));
        extension.setInstalledLocation(null);
        extension.setInstalledRevision(null);
      }
    }
    URL url=new URL(componentUrl);
    monitor.setTaskName(EcosConstants.DOWNLOAD_TASK_NAME + url.toString());
    ComponentDownloader downloader=new ComponentDownloader();
    downloader.addDownloadListener(this);
    downloader.download(url,localZipFile);
    if (!monitor.isCanceled()) {
      File componentFile=ComponentInstaller.unzip(localZipFile.getAbsolutePath(),targetFolder);
      extension.setInstalledRevision(extension.getLatestRevision());
      extension.setInstalledLocation(componentFile.getAbsolutePath());
      monitor.done();
      extensionDownloadCompleted(extension);
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}

Fixed version (ground truth):
private void downloadExtension(IEcosComponent extension,IProgressMonitor monitor){
  String componentUrl=extension.getLatestRevision().getUrl();
  monitor.setTaskName(EcosConstants.DOWNLOAD_TASK_NAME + componentUrl);
  String targetFolder=ResourceManager.getExchangeFolder().getLocation().toOSString();
  try {
    String fileName=extension.getLatestRevision().getFileName();
    File localZipFile=new File(targetFolder,fileName);
    if (extension.getInstalledLocation() != null && extension.getInstalledRevision() != null) {
      if (extension.getInstalledRevision().getName().equals(extension.getLatestRevision().getName())) {
        if (localZipFile.exists() && checkIfExisted(extension.getInstalledLocation())) {
          monitor.done();
          extensionDownloadCompleted(extension);
          return;
        }
      }
 else {
        FileUtils.deleteDirectory(new File(extension.getInstalledLocation()));
        extension.setInstalledLocation(null);
        extension.setInstalledRevision(null);
      }
    }
    URL url=new URL(componentUrl);
    monitor.setTaskName(EcosConstants.DOWNLOAD_TASK_NAME + url.toString());
    ComponentDownloader downloader=new ComponentDownloader();
    downloader.addDownloadListener(this);
    downloader.download(url,localZipFile);
    if (!monitor.isCanceled()) {
      File componentFile=ComponentInstaller.unzip(localZipFile.getAbsolutePath(),targetFolder);
      extension.setInstalledRevision(extension.getLatestRevision());
      extension.setInstalledLocation(componentFile.getAbsolutePath());
      monitor.done();
      extensionDownloadCompleted(extension);
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}