Program: 10721
Project: 10721
Buggy source:
public void refreshUI(){
  logError(null);
  resizeTableColumns();
  canUpdate=false;
  CloudFoundryApplicationModule appModule=null;
  try {
    appModule=getUpdatedApplication();
  }
 catch (  CoreException ce) {
    logApplicationModuleFailureError("String_Node_Str");
  }
  refreshPublishState(appModule);
  if (appModule == null) {
    return;
  }
  if (saveManifest != null) {
    ManifestParser parser=new ManifestParser(appModule,cloudServer);
    if (!parser.canWriteToManifest()) {
      saveManifest.setEnabled(false);
    }
 else {
      saveManifest.setEnabled(true);
    }
  }
  updateServerNameDisplay(appModule);
  int state=appModule.getState();
  setCurrentStartDebugApplicationAction();
  instanceSpinner.setSelection(appModule.getInstanceCount());
  refreshApplicationDeploymentButtons(appModule);
  mappedURIsLink.setEnabled(state == IServer.STATE_STARTED);
  CloudApplication cloudApplication=appModule.getApplication();
  instanceSpinner.setEnabled(cloudApplication != null);
  instancesViewer.getTable().setEnabled(cloudApplication != null);
  instancesViewer.setInput(null);
  memoryCombo.setEnabled(cloudApplication != null);
  if (cloudApplication != null) {
    int appMemory=appModule.getApplication().getMemory();
    memoryCombo.removeAll();
    boolean found=false;
    int[] applicationMemoryChoices=editorPage.getApplicationMemoryChoices();
    if (applicationMemoryChoices != null) {
      for (      int option : applicationMemoryChoices) {
        memoryCombo.add(option + "String_Node_Str");
        if (option == appMemory) {
          int index=memoryCombo.getItemCount() - 1;
          memoryCombo.select(index);
          found=true;
        }
      }
      if (!found && appMemory != 0) {
        memoryCombo.add(appMemory + "String_Node_Str",0);
        memoryCombo.select(0);
      }
      memoryCombo.setEnabled(true);
      memoryCombo.redraw();
    }
  }
  List<String> currentURIs=null;
  if (cloudApplication != null) {
    currentURIs=cloudApplication.getUris();
    ApplicationStats applicationStats=appModule.getApplicationStats();
    InstancesInfo instancesInfo=appModule.getInstancesInfo();
    if (applicationStats != null) {
      List<InstanceStats> statss=applicationStats.getRecords();
      List<InstanceInfo> infos=instancesInfo != null ? instancesInfo.getInstances() : null;
      InstanceStatsAndInfo[] statsAndInfos=new InstanceStatsAndInfo[statss.size()];
      for (int i=0; i < statss.size(); i++) {
        InstanceStats stats=statss.get(i);
        InstanceInfo info=null;
        if (infos != null && infos.size() > i) {
          info=infos.get(i);
        }
        statsAndInfos[i]=new InstanceStatsAndInfo(stats,info);
      }
      instancesViewer.setInput(statsAndInfos);
    }
  }
  if (currentURIs == null && !isPublished) {
    currentURIs=appModule.getDeploymentInfo() != null ? appModule.getDeploymentInfo().getUris() : null;
  }
  if (currentURIs == null) {
    currentURIs=Collections.emptyList();
  }
  if (!currentURIs.equals(URIs)) {
    URIs=currentURIs;
    mappedURIsLink.setText(getURIsAsLinkText(URIs));
    generalSection.getParent().layout(true,true);
    editorPage.reflow();
  }
  if (provideServices) {
    List<CloudService> updatedServices=new ArrayList<CloudService>();
    DeploymentInfoWorkingCopy deploymentInfo=appModule.getDeploymentInfoWorkingCopy();
    List<String> serviceNames=deploymentInfo.asServiceBindingList();
    if (serviceNames != null && !serviceNames.isEmpty()) {
      List<CloudService> allServices=editorPage.getServices();
      if (allServices != null) {
        for (        CloudService service : allServices) {
          if (serviceNames.contains(service.getName())) {
            updatedServices.add(service);
          }
        }
        if (!updatedServices.isEmpty()) {
          deploymentInfo.setServices(updatedServices);
          deploymentInfo.save();
        }
      }
      servicesViewer.setInput(updatedServices.toArray(new CloudService[updatedServices.size()]));
    }
    servicesDropListener.setModule(appModule);
    servicesViewer.refresh(true);
  }
  instancesViewer.refresh(true);
  canUpdate=true;
  if (appModule.getErrorMessage() != null) {
    editorPage.setMessage(appModule.getErrorMessage(),IMessageProvider.ERROR);
  }
 else {
    editorPage.setMessage(null,IMessageProvider.ERROR);
  }
}

Fixed version (ground truth):
public void refreshUI(){
  logError(null);
  resizeTableColumns();
  canUpdate=false;
  CloudFoundryApplicationModule appModule=null;
  try {
    appModule=getUpdatedApplication();
  }
 catch (  CoreException ce) {
    logApplicationModuleFailureError("String_Node_Str");
  }
  refreshPublishState(appModule);
  if (appModule == null) {
    return;
  }
  if (saveManifest != null) {
    ManifestParser parser=new ManifestParser(appModule,cloudServer);
    if (!parser.canWriteToManifest()) {
      saveManifest.setEnabled(false);
    }
 else {
      saveManifest.setEnabled(true);
    }
  }
  updateServerNameDisplay(appModule);
  int state=appModule.getState();
  setCurrentStartDebugApplicationAction();
  instanceSpinner.setSelection(appModule.getInstanceCount());
  refreshApplicationDeploymentButtons(appModule);
  mappedURIsLink.setEnabled(state == IServer.STATE_STARTED);
  CloudApplication cloudApplication=appModule.getApplication();
  instanceSpinner.setEnabled(cloudApplication != null);
  instancesViewer.getTable().setEnabled(cloudApplication != null);
  instancesViewer.setInput(null);
  memoryCombo.setEnabled(cloudApplication != null);
  if (cloudApplication != null) {
    int appMemory=appModule.getApplication().getMemory();
    int[] applicationMemoryChoices=editorPage.getApplicationMemoryChoices();
    if (applicationMemoryChoices != null && applicationMemoryChoices.length > 0) {
      boolean found=false;
      memoryCombo.removeAll();
      for (      int option : applicationMemoryChoices) {
        memoryCombo.add(option + "String_Node_Str");
        if (option == appMemory) {
          int index=memoryCombo.getItemCount() - 1;
          memoryCombo.select(index);
          found=true;
        }
      }
      if (!found && appMemory != 0) {
        memoryCombo.add(appMemory + "String_Node_Str",0);
        memoryCombo.select(0);
      }
      memoryCombo.setEnabled(true);
      memoryCombo.redraw();
    }
  }
  List<String> currentURIs=null;
  if (cloudApplication != null) {
    currentURIs=cloudApplication.getUris();
    ApplicationStats applicationStats=appModule.getApplicationStats();
    InstancesInfo instancesInfo=appModule.getInstancesInfo();
    if (applicationStats != null) {
      List<InstanceStats> statss=applicationStats.getRecords();
      List<InstanceInfo> infos=instancesInfo != null ? instancesInfo.getInstances() : null;
      InstanceStatsAndInfo[] statsAndInfos=new InstanceStatsAndInfo[statss.size()];
      for (int i=0; i < statss.size(); i++) {
        InstanceStats stats=statss.get(i);
        InstanceInfo info=null;
        if (infos != null && infos.size() > i) {
          info=infos.get(i);
        }
        statsAndInfos[i]=new InstanceStatsAndInfo(stats,info);
      }
      instancesViewer.setInput(statsAndInfos);
    }
  }
  if (currentURIs == null && !isPublished) {
    currentURIs=appModule.getDeploymentInfo() != null ? appModule.getDeploymentInfo().getUris() : null;
  }
  if (currentURIs == null) {
    currentURIs=Collections.emptyList();
  }
  if (!currentURIs.equals(URIs)) {
    URIs=currentURIs;
    mappedURIsLink.setText(getURIsAsLinkText(URIs));
    generalSection.getParent().layout(true,true);
    editorPage.reflow();
  }
  if (provideServices) {
    List<CloudService> updatedServices=new ArrayList<CloudService>();
    DeploymentInfoWorkingCopy deploymentInfo=appModule.getDeploymentInfoWorkingCopy();
    List<String> serviceNames=deploymentInfo.asServiceBindingList();
    if (serviceNames != null && !serviceNames.isEmpty()) {
      List<CloudService> allServices=editorPage.getServices();
      if (allServices != null) {
        for (        CloudService service : allServices) {
          if (serviceNames.contains(service.getName())) {
            updatedServices.add(service);
          }
        }
        if (!updatedServices.isEmpty()) {
          deploymentInfo.setServices(updatedServices);
          deploymentInfo.save();
        }
      }
      servicesViewer.setInput(updatedServices.toArray(new CloudService[updatedServices.size()]));
    }
    servicesDropListener.setModule(appModule);
    servicesViewer.refresh(true);
  }
  instancesViewer.refresh(true);
  canUpdate=true;
  if (appModule.getErrorMessage() != null) {
    editorPage.setMessage(appModule.getErrorMessage(),IMessageProvider.ERROR);
  }
 else {
    editorPage.setMessage(null,IMessageProvider.ERROR);
  }
}